Cody

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

Solution 3126287

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

x = Columns 1 through 29 3 6 9 12 15 18 21 24 27 30 33 36 39 42 45 48 51 54 57 60 63 66 69 72 75 78 81 84 87 Column 30 90 y = Columns 1 through 29 3 6 9 12 15 18 21 24 27 30 33 36 39 42 45 48 51 54 57 60 63 66 69 72 75 78 81 84 87 Column 30 90

Assertion failed.

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

x = Columns 1 through 29 3 6 9 12 15 18 21 24 27 30 33 36 39 42 45 48 51 54 57 60 63 66 69 72 75 78 81 84 87 Column 30 90 y = Columns 1 through 29 3 6 9 12 15 18 21 24 27 30 33 36 39 42 45 48 51 54 57 60 63 66 69 72 75 78 81 84 87 Column 30 90

Assertion failed.

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

x = Columns 1 through 29 3 6 9 12 15 18 21 24 27 30 33 36 39 42 45 48 51 54 57 60 63 66 69 72 75 78 81 84 87 Column 30 90 y = Columns 1 through 29 3 6 9 12 15 18 21 24 27 30 33 36 39 42 45 48 51 54 57 60 63 66 69 72 75 78 81 84 87 Column 30 90

Assertion failed.

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

x = Columns 1 through 29 3 6 9 12 15 18 21 24 27 30 33 36 39 42 45 48 51 54 57 60 63 66 69 72 75 78 81 84 87 Column 30 90 y = Columns 1 through 29 3 6 9 12 15 18 21 24 27 30 33 36 39 42 45 48 51 54 57 60 63 66 69 72 75 78 81 84 87 Column 30 90

Assertion failed.

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

x = Columns 1 through 29 3 6 9 12 15 18 21 24 27 30 33 36 39 42 45 48 51 54 57 60 63 66 69 72 75 78 81 84 87 Column 30 90 y = Columns 1 through 29 3 6 9 12 15 18 21 24 27 30 33 36 39 42 45 48 51 54 57 60 63 66 69 72 75 78 81 84 87 Column 30 90

Assertion failed.

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

x = Columns 1 through 29 3 6 9 12 15 18 21 24 27 30 33 36 39 42 45 48 51 54 57 60 63 66 69 72 75 78 81 84 87 Column 30 90 y = Columns 1 through 29 3 6 9 12 15 18 21 24 27 30 33 36 39 42 45 48 51 54 57 60 63 66 69 72 75 78 81 84 87 Column 30 90

Assertion failed.

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

x = Columns 1 through 29 3 6 9 12 15 18 21 24 27 30 33 36 39 42 45 48 51 54 57 60 63 66 69 72 75 78 81 84 87 Column 30 90 y = Columns 1 through 29 3 6 9 12 15 18 21 24 27 30 33 36 39 42 45 48 51 54 57 60 63 66 69 72 75 78 81 84 87 Column 30 90

Assertion failed.

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

x = Columns 1 through 29 3 6 9 12 15 18 21 24 27 30 33 36 39 42 45 48 51 54 57 60 63 66 69 72 75 78 81 84 87 Column 30 90 y = Columns 1 through 29 3 6 9 12 15 18 21 24 27 30 33 36 39 42 45 48 51 54 57 60 63 66 69 72 75 78 81 84 87 Column 30 90

Assertion failed.

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

x = Columns 1 through 29 3 6 9 12 15 18 21 24 27 30 33 36 39 42 45 48 51 54 57 60 63 66 69 72 75 78 81 84 87 Column 30 90 y = Columns 1 through 29 3 6 9 12 15 18 21 24 27 30 33 36 39 42 45 48 51 54 57 60 63 66 69 72 75 78 81 84 87 Column 30 90

Assertion failed.

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

x = Columns 1 through 29 3 6 9 12 15 18 21 24 27 30 33 36 39 42 45 48 51 54 57 60 63 66 69 72 75 78 81 84 87 Column 30 90 y = Columns 1 through 29 3 6 9 12 15 18 21 24 27 30 33 36 39 42 45 48 51 54 57 60 63 66 69 72 75 78 81 84 87 Column 30 90

Assertion failed.

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

x = Columns 1 through 29 3 6 9 12 15 18 21 24 27 30 33 36 39 42 45 48 51 54 57 60 63 66 69 72 75 78 81 84 87 Column 30 90 y = Columns 1 through 29 3 6 9 12 15 18 21 24 27 30 33 36 39 42 45 48 51 54 57 60 63 66 69 72 75 78 81 84 87 Column 30 90

Assertion failed.

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

x = Columns 1 through 29 3 6 9 12 15 18 21 24 27 30 33 36 39 42 45 48 51 54 57 60 63 66 69 72 75 78 81 84 87 Column 30 90 y = Columns 1 through 29 3 6 9 12 15 18 21 24 27 30 33 36 39 42 45 48 51 54 57 60 63 66 69 72 75 78 81 84 87 Column 30 90

Assertion failed.

Suggested Problems

More from this Author68

Community Treasure Hunt

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

Start Hunting!