added a test case to make it a wee bit harder
function y = pow2_sumofdigits(x)
number = sym(2^x);
n = char(number);
y = 0;
for i = 1:length(n)
y = y + str2double(n(i));
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:
License path: firstname.lastname@example.org:email@example.com:/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.
Number of 1s in the Binary Representation of a Number
Reindex a vector
Wrapping the Tower of Pisa
Swap two numbers
Return the 'Size' of a String of Code
Triangle Numbers Below N
Right Triangle Side Lengths (Inspired by Project Euler Problem 39)
Guess the Coefficients!
The Dark Side of the Die
Find the treasures in MATLAB Central and discover how the community can help you!
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office