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
-
Sum of diagonal of a square matrix
1479 Solvers
-
Flag largest magnitude swings as they occur
649 Solvers
-
Determine if input is a Narcissistic number
166 Solvers
-
I've got the power! (Inspired by Project Euler problem 29)
103 Solvers
-
Determine the number of odd integers in a vector
590 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!