Cody

Problem 2576. Sum of series II

Solution 2779093

Submitted on 4 Aug 2020 by Neha Rai
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))

sum = 1

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

sum = 1 sum = 10

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

sum = 1 sum = 10 sum = 35

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

sum = 1 sum = 10 sum = 35 sum = 84

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

sum = 1 sum = 10 sum = 35 sum = 84 sum = 165

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

sum = 1 sum = 10 sum = 35 sum = 84 sum = 165 sum = 286 sum = 455 sum = 680 sum = 969 sum = 1330 sum = 1771

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

sum = 1 sum = 10 sum = 35 sum = 84 sum = 165 sum = 286 sum = 455 sum = 680 sum = 969 sum = 1330 sum = 1771 sum = 2300 sum = 2925 sum = 3654 sum = 4495 sum = 5456 sum = 6545 sum = 7770 sum = 9139 sum = 10660 sum = 12341 sum = 14190 sum = 16215 sum = 18424 sum = 20825 sum = 23426 sum = 26235 sum = 29260 sum = 32509 sum = 35990 sum = 39711 sum = 43680 sum = 47905 sum = 52394 sum = 57155 sum = 62196 sum = 67525 sum = 73150 sum = 79079 sum = 85320 sum = 91881 sum = 98770

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

sum = 1 sum = 10 sum = 35 sum = 84 sum = 165 sum = 286 sum = 455 sum = 680 sum = 969 sum = 1330 sum = 1771 sum = 2300 sum = 2925 sum = 3654 sum = 4495 sum = 5456 sum = 6545 sum = 7770 sum = 9139 sum = 10660 sum = 12341 sum = 14190 sum = 16215 sum = 18424 sum = 20825 sum = 23426 sum = 26235 sum = 29260 sum = 32509 sum = 35990 sum = 39711 sum = 43680 sum = 47905 sum = 52394 sum = 57155 sum = 62196 sum = 67525 sum = 73150 sum = 79079 sum = 85320 sum = 91881 sum = 98770 sum = 105995 sum = 113564 sum = 121485 sum = 129766 sum = 138415 sum = 147440 sum = 156849 sum = 166650 sum = 176851 sum = 187460 sum = 198485 sum = 209934 sum = 221815 sum = 234136 sum = 246905 sum = 260130 sum = 273819 sum = 287980 sum = 302621 sum = 317750 sum = 333375 sum = 349504 sum = 366145 sum = 383306 sum = 400995 sum = 419220 sum = 437989 sum = 457310 sum = 477191

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

sum = 1 sum = 10 sum = 35 sum = 84 sum = 165 sum = 286 sum = 455 sum = 680 sum = 969 sum = 1330 sum = 1771 sum = 2300 sum = 2925 sum = 3654 sum = 4495 sum = 5456 sum = 6545 sum = 7770 sum = 9139 sum = 10660 sum = 12341 sum = 14190 sum = 16215 sum = 18424 sum = 20825 sum = 23426 sum = 26235 sum = 29260 sum = 32509 sum = 35990 sum = 39711 sum = 43680 sum = 47905 sum = 52394 sum = 57155 sum = 62196 sum = 67525 sum = 73150 sum = 79079 sum = 85320 sum = 91881 sum = 98770 sum = 105995 sum = 113564 sum = 121485 sum = 129766 sum = 138415 sum = 147440 sum = 156849 sum = 166650 sum = 176851 sum = 187460 sum = 198485 sum = 209934 sum = 221815 sum = 234136 sum = 246905 sum = 260130 sum = 273819 sum = 287980 sum = 302621 sum = 317750 sum = 333375 sum = 349504 sum = 366145 sum = 383306 sum = 400995 sum = 419220 sum = 437989 sum = 457310 sum = 477191 sum = 497640 sum = 518665 sum = 540274 sum = 562475 sum = 585276 sum = 608685 sum = 632710 sum = 657359 sum = 682640 sum = 708561 sum = 735130 sum = 762355 sum = 790244 sum = 818805 sum = 848046 sum = 877975 sum = 908600 sum = 939929 sum = 971970 sum = 1004731 sum = 1038220 sum = 1072445 sum = 1107414 sum = 1143135 sum = 1179616 sum = 1216865 sum = 1254890 sum = 1293699 sum = 1333300 sum = 1373701 sum = 1414910 sum = 1456935 sum = 1499784 sum = 1543465 sum = 1587986 sum = 1633355 sum = 1679580 sum = 1726669 sum = 1774630 sum = 1823471 sum = 1873200 sum = 1923825 sum = 1975354 sum = 2027795 sum = 2081156 sum = 2135445 sum = 2190670 sum = 2246839 sum = 2303960 sum = 2362041 sum = 2421090 sum = 2481115

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!