Cody

Problem 2576. Sum of series II

Solution 2990881

Submitted on 25 Sep 2020 by Rashidunnby Ratul
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; s_correct = 1; assert(isequal(sumOfSeriesII(n),s_correct))

current_value = 1

2   Pass
n = 2; s_correct = 10; assert(isequal(sumOfSeriesII(n),s_correct))

current_value = 1 current_value = 9

3   Pass
n = 3; s_correct = 35; assert(isequal(sumOfSeriesII(n),s_correct))

current_value = 1 current_value = 9 current_value = 25

4   Pass
n = 4; s_correct = 84; assert(isequal(sumOfSeriesII(n),s_correct))

current_value = 1 current_value = 9 current_value = 25 current_value = 49

5   Pass
n = 5; s_correct = 165; assert(isequal(sumOfSeriesII(n),s_correct))

current_value = 1 current_value = 9 current_value = 25 current_value = 49 current_value = 81

6   Pass
n = 11; s_correct = 1771; assert(isequal(sumOfSeriesII(n),s_correct))

current_value = 1 current_value = 9 current_value = 25 current_value = 49 current_value = 81 current_value = 121 current_value = 169 current_value = 225 current_value = 289 current_value = 361 current_value = 441

7   Pass
n = 42; s_correct = 98770; assert(isequal(sumOfSeriesII(n),s_correct))

current_value = 1 current_value = 9 current_value = 25 current_value = 49 current_value = 81 current_value = 121 current_value = 169 current_value = 225 current_value = 289 current_value = 361 current_value = 441 current_value = 529 current_value = 625 current_value = 729 current_value = 841 current_value = 961 current_value = 1089 current_value = 1225 current_value = 1369 current_value = 1521 current_value = 1681 current_value = 1849 current_value = 2025 current_value = 2209 current_value = 2401 current_value = 2601 current_value = 2809 current_value = 3025 current_value = 3249 current_value = 3481 current_value = 3721 current_value = 3969 current_value = 4225 current_value = 4489 current_value = 4761 current_value = 5041 current_value = 5329 current_value = 5625 current_value = 5929 current_value = 6241 current_value = 6561 current_value = 6889

8   Pass
n = 71; s_correct = 477191; assert(isequal(sumOfSeriesII(n),s_correct))

current_value = 1 current_value = 9 current_value = 25 current_value = 49 current_value = 81 current_value = 121 current_value = 169 current_value = 225 current_value = 289 current_value = 361 current_value = 441 current_value = 529 current_value = 625 current_value = 729 current_value = 841 current_value = 961 current_value = 1089 current_value = 1225 current_value = 1369 current_value = 1521 current_value = 1681 current_value = 1849 current_value = 2025 current_value = 2209 current_value = 2401 current_value = 2601 current_value = 2809 current_value = 3025 current_value = 3249 current_value = 3481 current_value = 3721 current_value = 3969 current_value = 4225 current_value = 4489 current_value = 4761 current_value = 5041 current_value = 5329 current_value = 5625 current_value = 5929 current_value = 6241 current_value = 6561 current_value = 6889 current_value = 7225 current_value = 7569 current_value = 7921 current_value = 8281 current_value = 8649 current_value = 9025 current_value = 9409 current_value = 9801 current_value = 10201 current_value = 10609 current_value = 11025 current_value = 11449 current_value = 11881 current_value = 12321 current_value = 12769 current_value = 13225 current_value = 13689 current_value = 14161 current_value = 14641 current_value = 15129 current_value = 15625 current_value = 16129 current_value = 16641 current_value = 17161 current_value = 17689 current_value = 18225 current_value = 18769 current_value = 19321 current_value = 19881

9   Pass
n = 123; s_correct = 2481115; assert(isequal(sumOfSeriesII(n),s_correct))

current_value = 1 current_value = 9 current_value = 25 current_value = 49 current_value = 81 current_value = 121 current_value = 169 current_value = 225 current_value = 289 current_value = 361 current_value = 441 current_value = 529 current_value = 625 current_value = 729 current_value = 841 current_value = 961 current_value = 1089 current_value = 1225 current_value = 1369 current_value = 1521 current_value = 1681 current_value = 1849 current_value = 2025 current_value = 2209 current_value = 2401 current_value = 2601 current_value = 2809 current_value = 3025 current_value = 3249 current_value = 3481 current_value = 3721 current_value = 3969 current_value = 4225 current_value = 4489 current_value = 4761 current_value = 5041 current_value = 5329 current_value = 5625 current_value = 5929 current_value = 6241 current_value = 6561 current_value = 6889 current_value = 7225 current_value = 7569 current_value = 7921 current_value = 8281 current_value = 8649 current_value = 9025 current_value = 9409 current_value = 9801 current_value = 10201 current_value = 10609 current_value = 11025 current_value = 11449 current_value = 11881 current_value = 12321 current_value = 12769 current_value = 13225 current_value = 13689 current_value = 14161 current_value = 14641 current_value = 15129 current_value = 15625 current_value = 16129 current_value = 16641 current_value = 17161 current_value = 17689 current_value = 18225 current_value = 18769 current_value = 19321 current_value = 19881 current_value = 20449 current_value = 21025 current_value = 21609 current_value = 22201 current_value = 22801 current_value = 23409 current_value = 24025 current_value = 24649 current_value = 25281 current_value = 25921 current_value = 26569 current_value = 27225 current_value = 27889 current_value = 28561 current_value = 29241 current_value = 29929 current_value = 30625 current_value = 31329 current_value = 32041 current_value = 32761 current_value = 33489 current_value = 34225 current_value = 34969 current_value = 35721 current_value = 36481 current_value = 37249 current_value = 38025 current_value = 38809 current_value = 39601 current_value = 40401 current_value = 41209 current_value = 42025 current_value = 42849 current_value = 43681 current_value = 44521 current_value = 45369 current_value = 46225 current_value = 47089 current_value = 47961 current_value = 48841 current_value = 49729 current_value = 50625 current_value = 51529 current_value = 52441 current_value = 53361 current_value = 54289 current_value = 55225 current_value = 56169 current_value = 57121 current_value = 58081 current_value = 59049 current_value = 60025


Community Treasure Hunt

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

Start Hunting!