Cody

Problem 42935. Sums of cubes and squares of sums

Solution 2982199

Submitted on 23 Sep 2020 by Jens Kjærgaard Boldsen
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
n = 1; y_correct = 2; assert(isequal(cubesLessSquare(n),y_correct))

y = uint64 2

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

y = uint64 9

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

y = uint64 24

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

y = uint64 90

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

y = uint64 605

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

y = uint64 945624

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

y = uint64 15872

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

y = uint64 15578325

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

y = uint64 15504233562

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

y = uint64 15502753617120

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

y = uint64 15503197751395200

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

y = uint64 500010000050000

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

y = uint64 940835389047072

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!