Cody

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

Solution 1326500

Submitted on 3 Nov 2017 by Brendan Gray
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))

ans = []

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

ans = 2 5 10 11

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

ans = 1×0 empty double row vector

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

ans = 10 18 26 30

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

ans = 16 40 80 88

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

ans = 1×0 empty double row vector

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

ans = 80 144 208 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))

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

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

ans = 280 352 600 800 936 960

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

ans = 1×0 empty double row vector

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

ans = Columns 1 through 15 408 1360 1680 2280 2584 3304 3824 4080 4760 4968 5328 5712 5840 6040 6120 Column 16 6256

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

ans = 1160 2000 5000 5744 7600 8200 9592 10000 11000 11120

### Community Treasure Hunt

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

Start Hunting!