Cody

Problem 2578. Sum of series IV

Solution 1398845

Submitted on 30 Dec 2017 by Eric Lee
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

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

s = 1 s = -8

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

s = 1 s = -8 s = 17

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

s = 1 s = -8 s = 17 s = -32

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

s = 1 s = -8 s = 17 s = -32 s = 49 s = -72 s = 97

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

s = 1 s = -8 s = 17 s = -32 s = 49 s = -72 s = 97 s = -128 s = 161 s = -200 s = 241 s = -288

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

s = 1 s = -8 s = 17 s = -32 s = 49 s = -72 s = 97 s = -128 s = 161 s = -200 s = 241 s = -288 s = 337 s = -392 s = 449 s = -512 s = 577 s = -648 s = 721 s = -800 s = 881 s = -968 s = 1057 s = -1152 s = 1249 s = -1352 s = 1457 s = -1568 s = 1681 s = -1800 s = 1921 s = -2048 s = 2177

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

s = 1 s = -8 s = 17 s = -32 s = 49 s = -72 s = 97 s = -128 s = 161 s = -200 s = 241 s = -288 s = 337 s = -392 s = 449 s = -512 s = 577 s = -648 s = 721 s = -800 s = 881 s = -968 s = 1057 s = -1152 s = 1249 s = -1352 s = 1457 s = -1568 s = 1681 s = -1800 s = 1921 s = -2048 s = 2177 s = -2312 s = 2449 s = -2592 s = 2737 s = -2888 s = 3041 s = -3200 s = 3361 s = -3528 s = 3697 s = -3872 s = 4049 s = -4232 s = 4417 s = -4608 s = 4801 s = -5000 s = 5201 s = -5408 s = 5617 s = -5832 s = 6049 s = -6272 s = 6497 s = -6728 s = 6961