Cody

# Problem 2578. Sum of series IV

Solution 1940720

Submitted on 18 Sep 2019 by Ngo Minh Ngoc
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))

s = 0 a = 1 s = 1

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

s = 0 a = 1 s = 1 a = -9 s = -8

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

s = 0 a = 1 s = 1 a = -9 s = -8 a = 25 s = 17

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

s = 0 a = 1 s = 1 a = -9 s = -8 a = 25 s = 17 a = -49 s = -32

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

s = 0 a = 1 s = 1 a = -9 s = -8 a = 25 s = 17 a = -49 s = -32 a = 81 s = 49 a = -121 s = -72 a = 169 s = 97

6   Pass
n = 12; s_correct = -288; assert(isequal(sumOfSeriesIV(n),s_correct))

s = 0 a = 1 s = 1 a = -9 s = -8 a = 25 s = 17 a = -49 s = -32 a = 81 s = 49 a = -121 s = -72 a = 169 s = 97 a = -225 s = -128 a = 289 s = 161 a = -361 s = -200 a = 441 s = 241 a = -529 s = -288

7   Pass
n = 33; s_correct = 2177; assert(isequal(sumOfSeriesIV(n),s_correct))

s = 0 a = 1 s = 1 a = -9 s = -8 a = 25 s = 17 a = -49 s = -32 a = 81 s = 49 a = -121 s = -72 a = 169 s = 97 a = -225 s = -128 a = 289 s = 161 a = -361 s = -200 a = 441 s = 241 a = -529 s = -288 a = 625 s = 337 a = -729 s = -392 a = 841 s = 449 a = -961 s = -512 a = 1089 s = 577 a = -1225 s = -648 a = 1369 s = 721 a = -1521 s = -800 a = 1681 s = 881 a = -1849 s = -968 a = 2025 s = 1057 a = -2209 s = -1152 a = 2401 s = 1249 a = -2601 s = -1352 a = 2809 s = 1457 a = -3025 s = -1568 a = 3249 s = 1681 a = -3481 s = -1800 a = 3721 s = 1921 a = -3969 s = -2048 a = 4225 s = 2177

8   Pass
n = 59; s_correct = 6961; assert(isequal(sumOfSeriesIV(n),s_correct))

s = 0 a = 1 s = 1 a = -9 s = -8 a = 25 s = 17 a = -49 s = -32 a = 81 s = 49 a = -121 s = -72 a = 169 s = 97 a = -225 s = -128 a = 289 s = 161 a = -361 s = -200 a = 441 s = 241 a = -529 s = -288 a = 625 s = 337 a = -729 s = -392 a = 841 s = 449 a = -961 s = -512 a = 1089 s = 577 a = -1225 s = -648 a = 1369 s = 721 a = -1521 s = -800 a = 1681 s = 881 a = -1849 s = -968 a = 2025 s = 1057 a = -2209 s = -1152 a = 2401 s = 1249 a = -2601 s = -1352 a = 2809 s = 1457 a = -3025 s = -1568 a = 3249 s = 1681 a = -3481 s = -1800 a = 3721 s = 1921 a = -3969 s = -2048 a = 4225 s = 2177 a = -4489 s = -2312 a = 4761 s = 2449 a = -5041 s = -2592 a = 5329 s = 2737 a = -5625 s = -2888 a = 5929 s = 3041 a = -6241 s = -3200 a = 6561 s = 3361 a = -6889 s = -3528 a = 7225 s = 3697 a = -7569 s = -3872 a = 7921 s = 4049 a = -8281 s = -4232 a = 8649 s = 4417 a = -9025 s = -4608 a = 9409 s = 4801 a = -9801 s = -5000 a = 10201 s = 5201 a = -10609 s = -5408 a = 11025 s = 5617 a = -11449 s = -5832 a = 11881 s = 6049 a = -12321 s = -6272 a = 12769 s = 6497 a = -13225 s = -6728 a = 13689 s = 6961