Cody

Problem 2578. Sum of series IV

Solution 2815948

Submitted on 10 Aug 2020 by Joshua Burke
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 = 1 s = 1

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

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

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

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

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

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

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

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

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

s = 1 s = 1 -9 s = 1 -9 25 s = 1 -9 25 -49 s = 1 -9 25 -49 81 s = 1 -9 25 -49 81 -121 s = 1 -9 25 -49 81 -121 169 s = 1 -9 25 -49 81 -121 169 -225 s = 1 -9 25 -49 81 -121 169 -225 289 s = 1 -9 25 -49 81 -121 169 -225 289 -361 s = 1 -9 25 -49 81 -121 169 -225 289 -361 441 s = 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))

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

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

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

Suggested Problems

More from this Author9

Community Treasure Hunt

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

Start Hunting!