Cody

# Problem 44334. Sums of Multiple Pairs of Triangular Numbers

Solution 1336624

Submitted on 12 Nov 2017 by David Verrelli
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))

rows = 5 3 cols = 3 5 y = 6 15

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

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

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

rows = 4 cols = 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))

rows = 189 188 187 181 175 166 162 152 134 133 112 97 90 71 54 27 19 1 cols = 1 19 27 54 71 90 97 112 133 134 152 162 166 175 181 187 188 189 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'));

rows = 10 5 cols = 5 10 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));

rows = 8607 8606 8597 8594 8592 8562 8550 8517 8487 8468 8411 8387 8312 8297 8226 8199 8132 8102 8013 7992 7971 7872 7827 7745 7652 7562 7509 7382 7353 7187 7137 6959 6812 6777 6618 6582 6560 6317 6242 6108 6065 5927 5847 5573 5547 5504 5307 5262 5066 4812 4737 4475 4427 4208 4112 3942 3756 3582 3482 3249 3197 3144 2907 2822 2621 2535 2292 2237 1937 1830 1545 1437 1247 996 887 522 488 432 179 122 cols = 122 179 432 488 522 887 996 1247 1437 1545 1830 1937 2237 2292 2535 2621 2822 2907 3144 3197 3249 3482 3582 3756 3942 4112 4208 4427 4475 4737 4812 5066 5262 5307 5504 5547 5573 5847 5927 6065 6108 6242 6317 6560 6582 6618 6777 6812 6959 7137 7187 7353 7382 7509 7562 7652 7745 7827 7872 7971 7992 8013 8102 8132 8199 8226 8297 8312 8387 8411 8468 8487 8517 8550 8562 8592 8594 8597 8606 8607 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!