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 Solvers120
Suggested Problems
-
3109 Solvers
-
What is the distance from point P(x,y) to the line Ax + By + C = 0?
340 Solvers
-
Longest run of consecutive numbers
4252 Solvers
-
243 Solvers
-
10433 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!