Cody

# Problem 2578. Sum of series IV

Solution 2990890

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(sumOfSeriesIV(n),s_correct))

current_value = 1

2   Pass
n = 2; s_correct = -8; assert(isequal(sumOfSeriesIV(n),s_correct))

current_value = 1 current_value = -9

3   Pass
n = 3; s_correct = 17; assert(isequal(sumOfSeriesIV(n),s_correct))

current_value = 1 current_value = -9 current_value = 25

4   Pass
n = 4; s_correct = -32; assert(isequal(sumOfSeriesIV(n),s_correct))

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

5   Pass
n = 7; s_correct = 97; assert(isequal(sumOfSeriesIV(n),s_correct))

current_value = 1 current_value = -9 current_value = 25 current_value = -49 current_value = 81 current_value = -121 current_value = 169

6   Pass
n = 12; s_correct = -288; assert(isequal(sumOfSeriesIV(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

7   Pass
n = 33; s_correct = 2177; assert(isequal(sumOfSeriesIV(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

8   Pass
n = 59; s_correct = 6961; assert(isequal(sumOfSeriesIV(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

### Community Treasure Hunt

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

Start Hunting!