Cody

Problem 1106. I've got the power! (Inspired by Project Euler problem 29)

Solution 1932903

Submitted on 12 Sep 2019 by Doanh Pham
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Pass
assert(isequal(euler029(5,5),[4, 8, 9, 16, 25, 27, 32, 64, 81, 125, 243, 256, 625, 1024, 3125]));

2   Pass
assert(isequal(euler029(4,15),[4 8 9 16 25 27 32 36 49 64 81 100 121 125 128 144 169 196 216 225 243 256 343 512 625 729 1000 1024 1296 1331 1728 2048 2187 2197 2401 2744 3375 4096 6561 8192 10000 14641 16384 19683 20736 28561 32768 38416 50625 59049 65536 177147 262144 531441 1048576 1594323 4194304 4782969 14348907 16777216 67108864 268435456 1073741824]));

3   Pass
assert(isequal(euler029(10,10),[4,8,9,16,25,27,32,36,49,64,81,100,125,128,216,243,256,343,512,625,729,1000,1024,1296,2187,2401,3125,4096,6561,7776,10000,15625,16384,16807,19683,32768,46656,59049,65536,78125,100000,117649,262144,279936,390625,531441,823543,1000000,1048576,1679616,1953125,2097152,4782969,5764801,9765625,10000000,10077696,16777216,40353607,43046721,60466176,100000000,134217728,282475249,387420489,1000000000,1073741824,3486784401,10000000000]));

4   Pass
a=ceil(rand*80)+2 b=ceil(rand*80)+2 assert(isequal(euler029(a,b),euler029(b,a)))

a = 9 b = 50

5   Pass
assert(isequal(euler029(30,2),[4,8,9,16,25,32,36,49,64,81,100,121,128,144,169,196,225,256,289,324,361,400,441,484,512,529,576,625,676,729,784,841,900,1024,2048,4096,8192,16384,32768,65536,131072,262144,524288,1048576,2097152,4194304,8388608,16777216,33554432,67108864,134217728,268435456,536870912,1073741824]))

Suggested Problems

More from this Author80

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!