Cody

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

Solution 177497

Submitted on 14 Dec 2012
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   Fail
%% assert(isequal(euler029(5,5),[4, 8, 9, 16, 25, 27, 32, 64, 81, 125, 243, 256, 625, 1024, 3125]));

Error: Assertion failed.

2   Fail
%% 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]));

Error: Assertion failed.

3   Fail
%% 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]));

Error: Assertion failed.

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

a = 19 b = 34 ans = @(a,b)unique(power(vertcat(reshape(repmat(a,numel(b),1),[],1),reshape(repmat(b,numel(a),1),[],1)),vertcat(repmat(b',numel(a),1),repmat(a',numel(b),1)))) ans = 1.0e+43 * 0.0000 3.0035 ans = @(a,b)unique(power(vertcat(reshape(repmat(a,numel(b),1),[],1),reshape(repmat(b,numel(a),1),[],1)),vertcat(repmat(b',numel(a),1),repmat(a',numel(b),1)))) ans = 1.0e+43 * 0.0000 3.0035

5   Fail
%% 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]))

Error: Assertion failed.