Cody

# Problem 2576. Sum of series II

Solution 2990875

Submitted on 25 Sep 2020
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(sumOfSeriesII(n),s_correct))

current_value = 1

2   Fail
n = 2; s_correct = 10; assert(isequal(sumOfSeriesII(n),s_correct))

current_value = 1 current_value = 3

Assertion failed.

3   Fail
n = 3; s_correct = 35; assert(isequal(sumOfSeriesII(n),s_correct))

current_value = 1 current_value = 3 current_value = 5

Assertion failed.

4   Fail
n = 4; s_correct = 84; assert(isequal(sumOfSeriesII(n),s_correct))

current_value = 1 current_value = 3 current_value = 5 current_value = 7

Assertion failed.

5   Fail
n = 5; s_correct = 165; assert(isequal(sumOfSeriesII(n),s_correct))

current_value = 1 current_value = 3 current_value = 5 current_value = 7 current_value = 9

Assertion failed.

6   Fail
n = 11; s_correct = 1771; assert(isequal(sumOfSeriesII(n),s_correct))

current_value = 1 current_value = 3 current_value = 5 current_value = 7 current_value = 9 current_value = 11 current_value = 13 current_value = 15 current_value = 17 current_value = 19 current_value = 21

Assertion failed.

7   Fail
n = 42; s_correct = 98770; assert(isequal(sumOfSeriesII(n),s_correct))

current_value = 1 current_value = 3 current_value = 5 current_value = 7 current_value = 9 current_value = 11 current_value = 13 current_value = 15 current_value = 17 current_value = 19 current_value = 21 current_value = 23 current_value = 25 current_value = 27 current_value = 29 current_value = 31 current_value = 33 current_value = 35 current_value = 37 current_value = 39 current_value = 41 current_value = 43 current_value = 45 current_value = 47 current_value = 49 current_value = 51 current_value = 53 current_value = 55 current_value = 57 current_value = 59 current_value = 61 current_value = 63 current_value = 65 current_value = 67 current_value = 69 current_value = 71 current_value = 73 current_value = 75 current_value = 77 current_value = 79 current_value = 81 current_value = 83

Assertion failed.

8   Fail
n = 71; s_correct = 477191; assert(isequal(sumOfSeriesII(n),s_correct))

current_value = 1 current_value = 3 current_value = 5 current_value = 7 current_value = 9 current_value = 11 current_value = 13 current_value = 15 current_value = 17 current_value = 19 current_value = 21 current_value = 23 current_value = 25 current_value = 27 current_value = 29 current_value = 31 current_value = 33 current_value = 35 current_value = 37 current_value = 39 current_value = 41 current_value = 43 current_value = 45 current_value = 47 current_value = 49 current_value = 51 current_value = 53 current_value = 55 current_value = 57 current_value = 59 current_value = 61 current_value = 63 current_value = 65 current_value = 67 current_value = 69 current_value = 71 current_value = 73 current_value = 75 current_value = 77 current_value = 79 current_value = 81 current_value = 83 current_value = 85 current_value = 87 current_value = 89 current_value = 91 current_value = 93 current_value = 95 current_value = 97 current_value = 99 current_value = 101 current_value = 103 current_value = 105 current_value = 107 current_value = 109 current_value = 111 current_value = 113 current_value = 115 current_value = 117 current_value = 119 current_value = 121 current_value = 123 current_value = 125 current_value = 127 current_value = 129 current_value = 131 current_value = 133 current_value = 135 current_value = 137 current_value = 139 current_value = 141

Assertion failed.

9   Fail
n = 123; s_correct = 2481115; assert(isequal(sumOfSeriesII(n),s_correct))

current_value = 1 current_value = 3 current_value = 5 current_value = 7 current_value = 9 current_value = 11 current_value = 13 current_value = 15 current_value = 17 current_value = 19 current_value = 21 current_value = 23 current_value = 25 current_value = 27 current_value = 29 current_value = 31 current_value = 33 current_value = 35 current_value = 37 current_value = 39 current_value = 41 current_value = 43 current_value = 45 current_value = 47 current_value = 49 current_value = 51 current_value = 53 current_value = 55 current_value = 57 current_value = 59 current_value = 61 current_value = 63 current_value = 65 current_value = 67 current_value = 69 current_value = 71 current_value = 73 current_value = 75 current_value = 77 current_value = 79 current_value = 81 current_value = 83 current_value = 85 current_value = 87 current_value = 89 current_value = 91 current_value = 93 current_value = 95 current_value = 97 current_value = 99 current_value = 101 current_value = 103 current_value = 105 current_value = 107 current_value = 109 current_value = 111 current_value = 113 current_value = 115 current_value = 117 current_value = 119 current_value = 121 current_value = 123 current_value = 125 current_value = 127 current_value = 129 current_value = 131 current_value = 133 current_value = 135 current_value = 137 current_value = 139 current_value = 141 current_value = 143 current_value = 145 current_value = 147 current_value = 149 current_value = 151 current_value = 153 current_value = 155 current_value = 157 current_value = 159 current_value = 161 current_value = 163 current_value = 165 current_value = 167 current_value = 169 current_value = 171 current_value = 173 current_value = 175 current_value = 177 current_value = 179 current_value = 181 current_value = 183 current_value = 185 current_value = 187 current_value = 189 current_value = 191 current_value = 193 current_value = 195 current_value = 197 current_value = 199 current_value = 201 current_value = 203 current_value = 205 current_value = 207 current_value = 209 current_value = 211 current_value = 213 current_value = 215 current_value = 217 current_value = 219 current_value = 221 current_value = 223 current_value = 225 current_value = 227 current_value = 229 current_value = 231 current_value = 233 current_value = 235 current_value = 237 current_value = 239 current_value = 241 current_value = 243 current_value = 245

Assertion failed.

### Community Treasure Hunt

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

Start Hunting!