Problem 252. Project Euler: Problem 16, Sums of Digits of Powers of Two
Solution Stats
Problem Comments
-
1 Comment
added a test case to make it a wee bit harder
Solution Comments
-
2 Comments
function y = pow2_sumofdigits(x)
number = sym(2^x);
n = char(number);
y = 0;
for i = 1:length(n)
y = y + str2double(n(i));
end
end
this code gives exact results on my mechine but not work in cody show error
Error: License checkout failed.
License Manager Error -5
Cannot find a license for Symbolic_Toolbox.
Troubleshoot this issue by visiting:
http://www.mathworks.com/support/lme/R2013a/5
Diagnostic Information:
Feature: Symbolic_Toolbox
License path: 13501@10.206.97.41:13501@10.10.207.33:/tmp/matlabpref/.matlab/R2013a_licenses:/opt/mlsedu/matlab/R2013a/licenses/license.dat:/opt/mlsedu/matlab/R2013a/licenses
Licensing error: -5,0.
please help me ...........
Symbolic_Toolbox can't run on Cody.
Problem Recent Solvers119
Suggested Problems
-
Find state names that start with the letter N
1025 Solvers
-
Generate N equally spaced intervals between -L and L
798 Solvers
-
Determine the number of odd integers in a vector
591 Solvers
-
Is this triangle right-angled?
4636 Solvers
-
Return fibonacci sequence do not use loop and condition
403 Solvers
More from this Author56
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!