Cody

# Problem 2578. Sum of series IV

Solution 1999115

Submitted on 1 Nov 2019 by Asif Newaz
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))

a = 1 s = 1

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

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

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

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

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

a = 1 a = 1 -9 a = 1 -9 25 a = 1 -9 25 -49 s = -32

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

a = 1 a = 1 -9 a = 1 -9 25 a = 1 -9 25 -49 a = 1 -9 25 -49 81 a = 1 -9 25 -49 81 -121 a = 1 -9 25 -49 81 -121 169 s = 97

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

a = 1 a = 1 -9 a = 1 -9 25 a = 1 -9 25 -49 a = 1 -9 25 -49 81 a = 1 -9 25 -49 81 -121 a = 1 -9 25 -49 81 -121 169 a = 1 -9 25 -49 81 -121 169 -225 a = 1 -9 25 -49 81 -121 169 -225 289 a = 1 -9 25 -49 81 -121 169 -225 289 -361 a = 1 -9 25 -49 81 -121 169 -225 289 -361 441 a = 1 -9 25 -49 81 -121 169 -225 289 -361 441 -529 s = -288

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

a = 1 a = 1 -9 a = 1 -9 25 a = 1 -9 25 -49 a = 1 -9 25 -49 81 a = 1 -9 25 -49 81 -121 a = 1 -9 25 -49 81 -121 169 a = 1 -9 25 -49 81 -121 169 -225 a = 1 -9 25 -49 81 -121 169 -225 289 a = 1 -9 25 -49 81 -121 169 -225 289 -361 a = 1 -9 25 -49 81 -121 169 -225 289 -361 441 a = 1 -9 25 -49 81 -121 169 -225 289 -361 441 -529 a = 1 -9 25 -49 81 -121 169 -225 289 -361 441 -529 625 a = 1 -9 25 -49 81 -121 169 -225 289 -361 441 -529 625 -729 a = 1 -9 25 -49 81 -121 169 -225 289 -361 441 -529 625 -729 841 a = 1 -9 25 -49 81 -121 169 -225 289 -361 441 -529 625 -729 841 -961 a = Columns 1 through 15 1 -9 25 -49 81 -121 169 -225 289 -361 441 -529 625 -729 841 Columns 16 through 17 -961 1089 a = Columns 1 through 15 1 -9 25 -49 81 -121 169 -225 289 -361 441 -529 625 -729 841 Columns 16 through 18 -961 1089 -1225 a = Columns 1 through 15 1 -9 25 -49 81 -121 169 -225 289 -361 441 -529 625 -729 841 Columns 16 through 19 -961 1089 -1225 1369 a = Columns 1 through 15 1 -9 25 -49 81 -121 169 -225 289 -361 441 -529 625 -729 841 Columns 16 through 20 -961 1089 -1225 1369 -1521 a = Columns 1 through 15 1 -9 25 -49 81 -121 169 -225 289 -361 441 -529 625 -729 841 Columns 16 through 21 -961 1089 -1225 1369 -1521 1681 a = Columns 1 through 15 1 -9 25 -49 81 -121 169 -225 289 -361 441 -529 625 -729 841 Columns 16 through 22 -961 1089 -1225 1369 -1521 1681 -1849 a = Columns 1 through 15 1 -9 25 -49 81 -121 169 -225 289 -361 441 -529 625 -729 841 Columns 16 through 23 -961 1089 -1225 1369 -1521 1681 -1849 2025 a = Columns 1 through 15 1 -9 25 -49 81 -121 169 -225 289 -361 441 -529 625 -729 841 Columns 16 through 24 -961 1089 -1225 1369 -1521 1681 -1849 2025 -2209 a = Columns 1 through 15 1 -9 25 -49 81 -121 169 -225 289 -361 441 -529 625 -729 841 Columns 16 through 25 -961 1089 -1225 1369 -1521 1681 -1849 2025 -2209 2401 a = Columns 1 through 15 1 -9 25 -49 81 -121 169 -225 289 -361 441 -529 625 -729 841 Columns 16 through 26 -961 1089 -1225 1369 -1521 1681 -1849 2025 -2209 2401 -2601 a = Columns 1 through 15 1 -9 25 -49 81 -121 169 -225 289 -361 441 -529 625 -729 841 Columns 16 through 27 -961 1089 -1225 1369 -1521 1681 -1849 2025 -2209 2401 -2601 2809 a = Columns 1 through 15 1 -9 25 -49 81 -121 169 -225 289 -361 441 -529 625 -729 841 Columns 16 through 28 -961 1089 -1225 1369 -1521 1681 -1849 2025 -2209 2401 -2601 2809 -3025 a = Columns 1 through 15 1 -9 25 -49 81 -121 169 -225 289 -361 441 -529 625 -729 841 Columns 16 through 29 -961 1089 -1225 1369 -1521 1681 -1849 2025 -2209 2401 -2601 2809 -3025 3249 a = Columns 1 through 15 1 -9 25 -49 81 -121 169 -225 289 -361 441 -529 625 -729 841 Columns 16 through 30 -961 1089 -1225 1369 -1521 1681 -1849 2025 -2209 2401 -2601 2809 -3025 3249 -3481 a = Columns 1 through 15 1 -9 25 -49 81 -121 169 -225 289 -361 441 -529 625 -729 841 Columns 16 through 30 -961 1089 -1225 1369 -1521 1681 -1849 2025 -2209 2401 -2601 2809 -3025 3249 -3481 Column 31 3721 a = Columns 1 through 15 1 -9 25 -49 81 -121 169 -225 289 -361 441 -529 625 -729 841 Columns 16 through 30 -961 1089 -1225 1369 -1521 1681 -1849 2025 -2209 2401 -2601 2809 -3025 3249 -3481 Columns 31 through 32 3721 -3969 a = Columns 1 through 15 1 -9 25 -49 81 -121 169 -225 289 -361 441 -529 625 -729 841 Columns 16 through 30 -961 1089 -1225 1369 -1521 1681 -1849 2025 -2209 2401 -2601 2809 -3025 3249 -3481 Columns 31 through 33 3721 -3969 4225 s = 2177

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

a = 1 a = 1 -9 a = 1 -9 25 a = 1 -9 25 -49 a = 1 -9 25 -49 81 a = 1 -9 25 -49 81 -121 a = 1 -9 25 -49 81 -121 169 a = 1 -9 25 -49 81 -121 169 -225 a = 1 -9 25 -49 81 -121 169 -225 289 a = 1 -9 25 -49 81 -121 169 -225 289 -361 a = 1 -9 25 -49 81 -121 169 -225 289 -361 441 a = 1 -9 25 -49 81 -121 169 -225 289 -361 441 -529 a = 1 -9 25 -49 81 -121 169 -225 289 -361 441 -529 625 a = 1 -9 25 -49 81 -121 169 -225 289 -361 441 -529 625 -729 a = 1 -9 25 -49 81 -121 169 -225 289 -361 441 -529 625 -729 841 a = 1 -9 25 -49 81 -121 169 -225 289 -361 441 -529 625 -729 841 -961 a = Columns 1 through 15 1 -9 25 -49 81 -121 169 -225 289 -361 441 -529 625 -729 841 Columns 16 through 17 -961 1089 a = Columns 1 through 15 1 -9 25 -49 81 -121 169 -225 289 -361 441 -529 625 -729 841 Columns 16 through 18 -961 1089 -1225 a = Columns 1 through 15 1 -9 25 -49 81 -121 169 -225 289 -361 441 -529 625 -729 841 Columns 16 through 19 -961 1089 -1225 1369 a = Columns 1 through 15 1 -9 25 -49 81 -121 169 -225 289 -361 441 -529 625 -729 841 Columns 16 through 20 -961 1089 -1225 1369 -1521 a = Columns 1 through 15 1 -9 25 -49 81 -121 169 -225 289 -361 441 -529 625 -729 841 Columns 16 through 21 -961 1089 -1225 1369 -1521 1681 a = Columns 1 through 15 1 -9 25 -49 81 -121 169 -225 289 -361 441 -529 625 -729 841 Columns 16 through 22 -961 1089 -1225 1369 -1521 1681 -1849 a = Columns 1 through 15 1 -9 25 -49 81 -121 169 -225 289 -361 441 -529 625 -729 841 Columns 16 through 23 -961 1089 -1225 1369 -1521 1681 -1849 2025 a = Columns 1 through 15 1 -9 25 -49 81 -121 169 -225 289 -361 441 -529 625 -729 841 Columns 16 through 24 -961 1089 -1225 1369 -1521 1681 -1849 2025 -2209 a = Columns 1 through 15 1 -9 25 -49 81 -121 169 -225 289 -361 441 -529 625 -729 841 Columns 16 through 25 -961 1089 -1225 1369 -1521 1681 -1849 2025 -2209 2401 a = Columns 1 through 15 1 -9 25 -49 81 -121 169 -225 289 -361 441 -529 625 -729 841 Columns 16 through 26 -961 1089 -1225 1369 -1521 1681 -1849 2025 -2209 2401 -2601 a = Columns 1 through 15 1 -9 25 -49 81 -121 169 -225 289 -361 441 -529 625 -729 841 Columns 16 through 27 -961 1089 -1225 1369 -1521 1681 -1849 2025 -2209 2401 -2601 2809 a = Columns 1 through 15 1 -9 25 -49 81 -121 169 -225 289 -361 441 -529 625 -729 841 Columns 16 through 28 -961 1089 -1225 1369 -1521 1681 -1849 2025 -2209 2401 -2601 2809 -3025 a = Columns 1 through 15 1 -9 25 -49 81 -121 169 -225 289 -361 441 -529 625 -729 841 Columns 16 through 29 -961 1089 -1225 1369 -1521 1681 -1849 2025 -2209 2401 -2601 2809 -3025 3249 a = Columns 1 through 15 1 -9 25 -49 81 -121 169 -225 289 -361 441 -529 625 -729 841 Columns 16 through 30 -961 1089 -1225 1369 -1521 1681 -1849 2025 -2209 2401 -2601 2809 -3025 3249 -3481 a = Columns 1 through 15 1 -9 25 -49 81 -121 169 -225 289 -361 441 -529 625 -729 841 Columns 16 through 30 -961 1089 -1225 1369 -1521 1681 -1849 2025 -2209 2401 -2601 2809 -3025 3249 -3481 Column 31 3721 a = Columns 1 through 15 1 -9 25 -49 81 -121 169 -225 289 -361 441 -529 625 -729 841 Columns 16 through 30 -961 1089 -1225 1369 -1521 1681 -1849 2025 -2209 2401 -2601 2809 -3025 3249 -3481 Columns 31 through 32 3721 -3969 a = Columns 1 through 15 1 -9 25 -49 81 -121 169 -225 289 -361 441 -529 625 -729 841 Columns 16 through 30 -961 1089 -1225 1369 -1521 1681 -1849 2025 -2209 2401 -2601 2809 -3025 3249 -3481 Columns 31 through 33 3721 -3969 4225 a = Columns 1 through 15 1 -9 25 -49 81 -121 169 -225 289 -361 441 -529 625 -729 841 Columns 16 through 30 -961 1089 -1225 1369 -1521 1681 -1849 2025 -2209 2401 -2601 2809 -3025 3249 -3481 Columns 31 through 34 3721 -3969 4225 -4489 a = Columns 1 through 15 1 -9 25 -49 81 -121 169 -225 289 -361 441 -529 625 -729 841 Columns 16 through 30 -961 1089 -1225 1369 -1521 1681 -1849 2025 -2209 2401 -2601 2809 -3025 3249 -3481 Columns 31 through 35 3721 -3969 4225 -4489 4761 a = Columns 1 through 15 1 -9 25 -49 81 -121 169 -225 289 -361 441 -529 625 -729 841 Columns 16 through 30 -961 1089 -1225 1369 -1521 1681 -1849 2025 -2209 2401 -2601 2809 -3025 3249 -3481 Columns 31 through 36 3721 -3969 4225 -4489 4761 -5041 a = Columns 1 through 15 1 -9 25 -49 81 -121 169 -225 289 -361 441 -529 625 -729 841 Columns 16 through 30 -961 1089 -1225 1369 -1521 1681 -1849 2025 -2209 2401 -2601 2809 -3025 3249 -3481 Columns 31 through 37 3721 -3969 4225 -4489 4761 -5041 5329 a = Columns 1 through 15 1 -9 25 -49 81 -121 169 -225 289 -361 441 -529 625 -729 841 Columns 16 through 30 -961 1089 -1225 1369 -1521 1681 -1849 2025 -2209 2401 -2601 2809 -3025 3249 -3481 Columns 31 through 38 3721 -3969 4225 -4489 4761 -5041 5329 -5625 a = Columns 1 through 15 1 -9 25 -49 81 -121 169 -225 289 -361 441 -529 625 -729 841 Columns 16 through 30 -961 1089 -1225 1369 -15...