Cody

Problem 42935. Sums of cubes and squares of sums

Solution 3472788

Submitted on 29 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
n = 1; y_correct = 2; assert(isequal(cubesLessSquare(n),y_correct))

Unrecognized function or variable 'x'. Error in cubesLessSquare (line 2) y = uint64(((sum((1:x).^3)*2-sum(1:x)^2)/(x/2))); % your work goes here. be careful! Error in Test1 (line 3) assert(isequal(cubesLessSquare(n),y_correct))

2   Fail
n = 2; y_correct = 9; assert(isequal(cubesLessSquare(n),y_correct))

Unrecognized function or variable 'x'. Error in cubesLessSquare (line 2) y = uint64(((sum((1:x).^3)*2-sum(1:x)^2)/(x/2))); % your work goes here. be careful! Error in Test2 (line 3) assert(isequal(cubesLessSquare(n),y_correct))

3   Fail
n = 3; y_correct = 24; assert(isequal(cubesLessSquare(n),y_correct))

Unrecognized function or variable 'x'. Error in cubesLessSquare (line 2) y = uint64(((sum((1:x).^3)*2-sum(1:x)^2)/(x/2))); % your work goes here. be careful! Error in Test3 (line 3) assert(isequal(cubesLessSquare(n),y_correct))

4   Fail
n = 5; y_correct = 90; assert(isequal(cubesLessSquare(n),y_correct))

Unrecognized function or variable 'x'. Error in cubesLessSquare (line 2) y = uint64(((sum((1:x).^3)*2-sum(1:x)^2)/(x/2))); % your work goes here. be careful! Error in Test4 (line 3) assert(isequal(cubesLessSquare(n),y_correct))

5   Fail
n = 10; y_correct = 605; assert(isequal(cubesLessSquare(n),y_correct))

Unrecognized function or variable 'x'. Error in cubesLessSquare (line 2) y = uint64(((sum((1:x).^3)*2-sum(1:x)^2)/(x/2))); % your work goes here. be careful! Error in Test5 (line 3) assert(isequal(cubesLessSquare(n),y_correct))

6   Fail
n = 123; y_correct = 945624; assert(isequal(cubesLessSquare(n),y_correct))

Unrecognized function or variable 'x'. Error in cubesLessSquare (line 2) y = uint64(((sum((1:x).^3)*2-sum(1:x)^2)/(x/2))); % your work goes here. be careful! Error in Test6 (line 3) assert(isequal(cubesLessSquare(n),y_correct))

7   Fail
n = 31; y_correct = 15872; assert(isequal(cubesLessSquare(n),y_correct))

Unrecognized function or variable 'x'. Error in cubesLessSquare (line 2) y = uint64(((sum((1:x).^3)*2-sum(1:x)^2)/(x/2))); % your work goes here. be careful! Error in Test7 (line 3) assert(isequal(cubesLessSquare(n),y_correct))

8   Fail
n = 314; y_correct = 15578325; assert(isequal(cubesLessSquare(n),y_correct))

Unrecognized function or variable 'x'. Error in cubesLessSquare (line 2) y = uint64(((sum((1:x).^3)*2-sum(1:x)^2)/(x/2))); % your work goes here. be careful! Error in Test8 (line 3) assert(isequal(cubesLessSquare(n),y_correct))

9   Fail
n = 3141; y_correct = 15504233562; assert(isequal(cubesLessSquare(n),y_correct))

Unrecognized function or variable 'x'. Error in cubesLessSquare (line 2) y = uint64(((sum((1:x).^3)*2-sum(1:x)^2)/(x/2))); % your work goes here. be careful! Error in Test9 (line 3) assert(isequal(cubesLessSquare(n),y_correct))

10   Fail
n = 31415; y_correct = 15502753617120; assert(isequal(cubesLessSquare(n),y_correct))

Unrecognized function or variable 'x'. Error in cubesLessSquare (line 2) y = uint64(((sum((1:x).^3)*2-sum(1:x)^2)/(x/2))); % your work goes here. be careful! Error in Test10 (line 3) assert(isequal(cubesLessSquare(n),y_correct))

11   Fail
n = 314159; y_correct = uint64(15503197751395200); assert(isequal(cubesLessSquare(n),y_correct))

Unrecognized function or variable 'x'. Error in cubesLessSquare (line 2) y = uint64(((sum((1:x).^3)*2-sum(1:x)^2)/(x/2))); % your work goes here. be careful! Error in Test11 (line 3) assert(isequal(cubesLessSquare(n),y_correct))

12   Fail
n = 1e5; y_correct = uint64(500010000050000); assert(isequal(cubesLessSquare(n),y_correct))

Unrecognized function or variable 'x'. Error in cubesLessSquare (line 2) y = uint64(((sum((1:x).^3)*2-sum(1:x)^2)/(x/2))); % your work goes here. be careful! Error in Test12 (line 3) assert(isequal(cubesLessSquare(n),y_correct))

13   Fail
n = 123456; y_correct = uint64(940835389047072); assert(isequal(cubesLessSquare(n),y_correct))

Unrecognized function or variable 'x'. Error in cubesLessSquare (line 2) y = uint64(((sum((1:x).^3)*2-sum(1:x)^2)/(x/2))); % your work goes here. be careful! Error in Test13 (line 3) assert(isequal(cubesLessSquare(n),y_correct))

Suggested Problems

More from this Author4

Community Treasure Hunt

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

Start Hunting!