Cody

# Problem 44319. Write c^3 as sum of two squares a^2+b^2

Solution 1301502

Submitted on 19 Oct 2017 by cokakola
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
c = 1; y_correct = []; assert(isequal(sumoftwosquares(c),y_correct))

maxb = 1 y = []

2   Pass
c = 5; y_correct = [2 11; 5 10]; assert(isequal(sumoftwosquares(c),y_correct))

maxb = 11 a = 5 b = 10 a = 2 b = 11

3   Pass
c = 6; y_correct = []; assert(isequal(sumoftwosquares(c),y_correct))

maxb = 14 y = []

4   Pass
c = 10; y_correct = [10 30; 18 26]; assert(isequal(sumoftwosquares(c),y_correct))

maxb = 31 a = 18 b = 26 a = 10 b = 30

5   Pass
c = 20; y_correct = [16 88; 40 80]; assert(isequal(sumoftwosquares(c),y_correct))

maxb = 89 a = 40 b = 80 a = 16 b = 88

6   Pass
c = 24; y_correct = []; assert(isequal(sumoftwosquares(c),y_correct))

maxb = 117 y = []

7   Pass
c = 40; y_correct = [80 240; 144 208]; assert(isequal(sumoftwosquares(c),y_correct))

maxb = 252 a = 144 b = 208 a = 80 b = 240

8   Pass
c = 65; y_correct = [7 524; 65 520; 140 505; 191 488; 208 481; 260 455; 320 415; 364 377]; assert(isequal(sumoftwosquares(c),y_correct))

maxb = 524 a = 364 b = 377 a = 320 b = 415 a = 260 b = 455 a = 208 b = 481 a = 191 b = 488 a = 140 b = 505 a = 65 b = 520 a = 7 b = 524

9   Pass
c = 100; y_correct = [280 960; 352 936; 600 800]; assert(isequal(sumoftwosquares(c),y_correct))

maxb = 1000 a = 600 b = 800 a = 352 b = 936 a = 280 b = 960

10   Pass
c = 123; y_correct = []; assert(isequal(sumoftwosquares(c),y_correct))

maxb = 1364 y = []

11   Pass
c = 340; y_correct = [408 6256;1360 6120; 1680 6040; 2280 5840; 2584 5712; 3304 5328; 3824 4968; 4080 4760]; assert(isequal(sumoftwosquares(c),y_correct))

maxb = 6269 a = 4080 b = 4760 a = 3824 b = 4968 a = 3304 b = 5328 a = 2584 b = 5712 a = 2280 b = 5840 a = 1680 b = 6040 a = 1360 b = 6120 a = 408 b = 6256

12   Pass
c = 500; y_correct = [1160 11120; 2000 11000; 5000 10000; 5744 9592; 7600 8200]; assert(isequal(sumoftwosquares(c),y_correct))

maxb = 11180 a = 7600 b = 8200 a = 5744 b = 9592 a = 5000 b = 10000 a = 2000 b = 11000 a = 1160 b = 11120