Cody

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

Solution 1295456

Submitted on 18 Oct 2017 by margreet docter
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))

cc = 1 a2 = [] b2 = [] y = 0×2 empty double matrix y = []

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

cc = 11.1803 a2 = 11 10 5 2 b2 = 2 5 10 11 y = 2 11 5 10

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

cc = 14.6969 a2 = [] b2 = [] y = 0×2 empty double matrix y = []

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

cc = 31.6228 a2 = 30 26 18 10 b2 = 10 18 26 30 y = 10 30 18 26

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

cc = 89.4427 a2 = 88 80 40 16 b2 = 16 40 80 88 y = 16 88 40 80

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

cc = 117.5755 a2 = [] b2 = [] y = 0×2 empty double matrix y = []

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

cc = 252.9822 a2 = 240 208 144 80 b2 = 80 144 208 240 y = 80 240 144 208

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))

cc = 524.0468 a2 = 524 520 505 488 481 455 415 377 364 320 260 208 191 140 65 7 b2 = 7 65 140 191 208 260 320 364 377 415 455 481 488 505 520 524 y = 7 524 65 520 140 505 191 488 208 481 260 455 320 415 364 377

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

cc = 1000 a2 = 960 936 800 600 352 280 b2 = 280 352 600 800 936 960 y = 280 960 352 936 600 800

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

cc = 1.3641e+03 a2 = [] b2 = [] y = 0×2 empty double matrix 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))

cc = 6.2693e+03 a2 = Columns 1 through 14 6256 6120 6040 5840 5712 5328 4968 4760 4080 3824 3304 2584 2280 1680 Columns 15 through 16 1360 408 b2 = Columns 1 through 14 408 1360 1680 2280 2584 3304 3824 4080 4760 4968 5328 5712 5840 6040 Columns 15 through 16 6120 6256 y = 408 6256 1360 6120 1680 6040 2280 5840 2584 5712 3304 5328 3824 4968 4080 4760

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

cc = 1.1180e+04 a2 = 11120 11000 10000 9592 8200 7600 5744 5000 2000 1160 b2 = 1160 2000 5000 5744 7600 8200 9592 10000 11000 11120 y = 1160 11120 2000 11000 5000 10000 5744 9592 7600 8200