Cody

# Problem 44334. Sums of Multiple Pairs of Triangular Numbers

Solution 1323063

Submitted on 1 Nov 2017 by Jens Kjærgaard Boldsen
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
x = 21; y_correct = [6;15]; assert(isequal(multi_triangular(x),y_correct))

tst = 5 3 y = 6 15

2   Pass
x=81; y_correct=[ 3 15 36 ; 78 66 45]; assert(isequal(multi_triangular(x),y_correct))

tst = 12 11 9 8 5 2 y = 3 15 36 78 66 45

3   Pass
x=20; y_correct=[ 10 10]; assert(isequal(multi_triangular(x),y_correct'))

tst = 4 y = 10 10

4   Pass
x=17956; y_correct=[ 1 190 378 1485 2556 4095 4753 6328 8911; 17955 17766 17578 16471 15400 13861 13203 11628 9045]; assert(isequal(multi_triangular(x),y_correct))

tst = 189 188 187 181 175 166 162 152 134 133 112 97 90 71 54 27 19 1 y = 1 190 378 1485 2556 4095 4753 6328 8911 17955 17766 17578 16471 15400 13861 13203 11628 9045

5   Pass
x=70; y_correct=[15 55]; assert(isequal(multi_triangular(x),y_correct'));

tst = 10 5 y = 15 55

6   Pass
x=37052031; y_correct=[7503 16110 93528 119316 136503 393828 496506 778128 1033203 1194285 1675365 1876953 2503203 2627778 3214380 3436131 3983253 4226778 4943940 5112003 5279625 6063903 6417153 7055646 7771653 8456328 8855736 9801378 10015050 11221953 11580078 12834711 13846953 14084778 15149760 15387378 15531951 17096628 17567628 18395145; 37044528 37035921 36958503 36932715 36915528 36658203 36555525 36273903 36018828 35857746 35376666 35175078 34548828 34424253 33837651 33615900 33068778 32825253 32108091 31940028 31772406 30988128 30634878 29996385 29280378 28595703 28196295 27250653 27036981 25830078 25471953 24217320 23205078 22967253 21902271 21664653 21520080 19955403 19484403 18656886]; assert(isequal(multi_triangular(x),y_correct));

tst = Columns 1 through 14 8607 8606 8597 8594 8592 8562 8550 8517 8487 8468 8411 8387 8312 8297 Columns 15 through 28 8226 8199 8132 8102 8013 7992 7971 7872 7827 7745 7652 7562 7509 7382 Columns 29 through 42 7353 7187 7137 6959 6812 6777 6618 6582 6560 6317 6242 6108 6065 5927 Columns 43 through 56 5847 5573 5547 5504 5307 5262 5066 4812 4737 4475 4427 4208 4112 3942 Columns 57 through 70 3756 3582 3482 3249 3197 3144 2907 2822 2621 2535 2292 2237 1937 1830 Columns 71 through 80 1545 1437 1247 996 887 522 488 432 179 122 y = Columns 1 through 14 7503 16110 93528 119316 136503 393828 496506 778128 1033203 1194285 1675365 1876953 2503203 2627778 37044528 37035921 36958503 36932715 36915528 36658203 36555525 36273903 36018828 35857746 35376666 35175078 34548828 34424253 Columns 15 through 28 3214380 3436131 3983253 4226778 4943940 5112003 5279625 6063903 6417153 7055646 7771653 8456328 8855736 9801378 33837651 33615900 33068778 32825253 32108091 31940028 31772406 30988128 30634878 29996385 29280378 28595703 28196295 27250653 Columns 29 through 40 10015050 11221953 11580078 12834711 13846953 14084778 15149760 15387378 15531951 17096628 17567628 18395145 27036981 25830078 25471953 24217320 23205078 22967253 21902271 21664653 21520080 19955403 19484403 18656886

### Community Treasure Hunt

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

Start Hunting!