Cody

# Problem 44334. Sums of Multiple Pairs of Triangular Numbers

Solution 1301342

Submitted on 19 Oct 2017 by Atnas
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))

ans = 3 5 5 3 [Warning: Integer operands are required for colon operator when used as index] ans = 6 15

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

ans = 2 12 5 11 8 9 9 8 11 5 12 2 [Warning: Integer operands are required for colon operator when used as index] ans = 3 15 36 78 66 45

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

ans = 4 4 ans = 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))

ans = 1 189 19 188 27 187 54 181 71 175 90 166 97 162 112 152 133 134 134 133 152 112 162 97 166 90 175 71 181 54 187 27 188 19 189 1 [Warning: Integer operands are required for colon operator when used as index] ans = 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'));

ans = 5 10 10 5 [Warning: Integer operands are required for colon operator when used as index] ans = 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));

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