Cody

# Problem 44334. Sums of Multiple Pairs of Triangular Numbers

Solution 1292900

Submitted on 17 Oct 2017 by Reggie Wilcox
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))

y = [] nmax = 4 T = 1 T2 = 20 n = 5.8443 T = 3 T2 = 18 n = 5.5208 T = 6 T2 = 15 n = 5 y = 6 15 T = 10 T2 = 11 n = 4.2170

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

y = [] nmax = 8 T = 1 T2 = 80 n = 12.1590 T = 3 T2 = 78 n = 12 y = 3 78 T = 6 T2 = 75 n = 11.7577 T = 10 T2 = 71 n = 11.4269 T = 15 T2 = 66 n = 11 y = 3 15 78 66 T = 21 T2 = 60 n = 10.4659 T = 28 T2 = 53 n = 9.8078 T = 36 T2 = 45 n = 9 y = 3 15 36 78 66 45

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

y = [] nmax = 4 T = 1 T2 = 19 n = 5.6847 T = 3 T2 = 17 n = 5.3523 T = 6 T2 = 14 n = 4.8151 T = 10 T2 = 10 n = 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))

y = [] nmax = 133 T = 1 T2 = 17955 n = 189 y = 1 17955 T = 3 T2 = 17953 n = 188.9894 T = 6 T2 = 17950 n = 188.9736 T = 10 T2 = 17946 n = 188.9525 T = 15 T2 = 17941 n = 188.9261 T = 21 T2 = 17935 n = 188.8944 T = 28 T2 = 17928 n = 188.8575 T = 36 T2 = 17920 n = 188.8152 T = 45 T2 = 17911 n = 188.7677 T = 55 T2 = 17901 n = 188.7148 T = 66 T2 = 17890 n = 188.6567 T = 78 T2 = 17878 n = 188.5932 T = 91 T2 = 17865 n = 188.5245 T = 105 T2 = 17851 n = 188.4504 T = 120 T2 = 17836 n = 188.3710 T = 136 T2 = 17820 n = 188.2863 T = 153 T2 = 17803 n = 188.1962 T = 171 T2 = 17785 n = 188.1008 T = 190 T2 = 17766 n = 188 y = 1 190 17955 17766 T = 210 T2 = 17746 n = 187.8939 T = 231 T2 = 17725 n = 187.7824 T = 253 T2 = 17703 n = 187.6655 T = 276 T2 = 17680 n = 187.5432 T = 300 T2 = 17656 n = 187.4155 T = 325 T2 = 17631 n = 187.2825 T = 351 T2 = 17605 n = 187.1439 T = 378 T2 = 17578 n = 187 y = 1 190 378 17955 17766 17578 T = 406 T2 = 17550 n = 186.8506 T = 435 T2 = 17521 n = 186.6958 T = 465 T2 = 17491 n = 186.5354 T = 496 T2 = 17460 n = 186.3696 T = 528 T2 = 17428 n = 186.1983 T = 561 T2 = 17395 n = 186.0214 T = 595 T2 = 17361 n = 185.8391 T = 630 T2 = 17326 n = 185.6511 T = 666 T2 = 17290 n = 185.4577 T = 703 T2 = 17253 n = 185.2586 T = 741 T2 = 17215 n = 185.0539 T = 780 T2 = 17176 n = 184.8436 T = 820 T2 = 17136 n = 184.6277 T = 861 T2 = 17095 n = 184.4061 T = 903 T2 = 17053 n = 184.1788 T = 946 T2 = 17010 n = 183.9458 T = 990 T2 = 16966 n = 183.7071 T = 1035 T2 = 16921 n = 183.4626 T = 1081 T2 = 16875 n = 183.2124 T = 1128 T2 = 16828 n = 182.9564 T = 1176 T2 = 16780 n = 182.6946 T = 1225 T2 = 16731 n = 182.4269 T = 1275 T2 = 16681 n = 182.1534 T = 1326 T2 = 16630 n = 181.8739 T = 1378 T2 = 16578 n = 181.5886 T = 1431 T2 = 16525 n = 181.2973 T = 1485 T2 = 16471 n = 181 y = 1 190 378 1485 17955 17766 17578 16471 T = 1540 T2 = 16416 n = 180.6967 T = 1596 T2 = 16360 n = 180.3874 T = 1653 T2 = 16303 n = 180.0720 T = 1711 T2 = 16245 n = 179.7505 T = 1770 T2 = 16186 n = 179.4229 T = 1830 T2 = 16126 n = 179.0891 T = 1891 T2 = 16065 n = 178.7491 T = 1953 T2 = 16003 n = 178.4029 T = 2016 T2 = 15940 n = 178.0504 T = 2080 T2 = 15876 n = 177.6916 T = 2145 T2 = 15811 n = 177.3265 T = 2211 T2 = 15745 n = 176.9549 T = 2278 T2 = 15678 n = 176.5770 T = 2346 T2 = 15610 n = 176.1925 T = 2415 T2 = 15541 n = 175.8016 T = 2485 T2 = 15471 n = 175.4041 T = 2556 T2 = 15400 n = 175 y = 1 190 378 1485 2556 17955 17766 17578 16471 15400 T = 2628 T2 = 15328 n = 174.5893 T = 2701 T2 = 15255 n = 174.1718 T = 2775 T2 = 15181 n = 173.7477 T = 2850 T2 = 15106 n = 173.3167 T = 2926 T2 = 15030 n = 172.8789 T = 3003 T2 = 14953 n = 172.4342 T = 3081 T2 = 14875 n = 171.9826 T = 3160 T2 = 14796 n = 171.5240 T = 3240 T2 = 14716 n = 171.0583 T = 3321 T2 = 14635 n = 170.5855 T = 3403 T2 = 14553 n = 170.1055 T = 3486 T2 = 14470 n = 169.6183 T = 3570 T2 = 14386 n = 169.1238 T = 3655 T2 = 14301 n = 168.6220 T = 3741 T2 = 14215 n = 168.1127 T = 3828 T2 = 14128 n = 167.5960 T = 3916 T2 = 14040 n = 167.0716 T = 4005 T2 = 13951 n = 166.5397 T = 4095 T2 = 13861 n = 166 y = 1 190 378 1485 2556 4095 17955 17766 17578 16471 15400 13861 T = 4186 T2 = 13770 n = 165.4526 T = 4278 T2 = 13678 n = 164.8972 T = 4371 T2 = 13585 n = 164.3340 T = 4465 T2 = 13491 n = 163.7627 T = 4560 T2 = 13396 n = 163.1834 T = 4656 T2 = 13300 n = 162.5958 T = 4753 T2 = 13203 n = 162 y = 1 190 378 1485 2556 4095 4753 17955 17766 17578 16471 15400 13861 13203 T = 4851 T2 = 13105 n = 161.3958 T = 4950 T2 = 13006 n = 160.7831 T = 5050 T2 = 12906 n = 160.1619 T = 5151 T2 = 12805 n = 159.5320 T = 5253 T2 = 12703 n = 158.8934 T = 5356 T2 = 12600 n = 158.2459 T = 5460 T2 = 12496 n = 157.5894 T = 5565 T2 = 12391 n = 156.9238 T = 5671 T2 = 12285 n = 156.2490 T = 5778 T2 = 12178 n = 155.5649 T = 5886 T2 = 12070 n = 154.8713 T = 5995 T2 = 11961 n = 154.1682 T = 6105 T2 = 11851 n = 153.4554 T = 6216 T2 = 11740 n = 152.7327 T = 6328 T2 = 11628 n = 152 y = 1 190 378 1485 2556 4095 4753 6328 17955 17766 17578 16471 15400 13861 13203 11628 T = 6441 T2 = 11515 n = 151.2572 T = 6555 T2 = 11401 n = 150.5041 T = 6670 T2 = 11286 n = 149.7406 T = 6786 T2 = 11170 n = 148.9666 T = 6903 T2 = 11053 n = 148.1817 T = 7021 T2 = 10935 n = 147.3859 T = 7140 T2 = 10816 n = 146.5791 T = 7260 T2 = 10696 n = 145.7609 T = 7381 T2 = 10575 n = 144.9313 T = 7503 T2 = 10453 n = 144.0899 T = 7626 T2 = 10330 n = 143.2367 T = 7750 T2 = 10206 n = 142.3714 T = 7875 T2 = 10081 n = 141.4938 T = 8001 T2 = 9955 n = 140.6037 T = 8128 T2 = 9828 n = 139.7007 T = 8256 T2 = 9700 n = 138.7848 T = 8385 T2 = 9571 n = 137.8555 T = 8515 T2 = 9441 n = 136.9127 T = 8646 T2 = 9310 n = 135.9560 T = 8778 T2 = 9178 n = 134.9852 T = 8911 T2 = 9045 n = 134 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'));

y = [] nmax = 7 T = 1 T2 = 69 n = 11.2580 T = 3 T2 = 67 n = 11.0866 T = 6 T2 = 64 n = 10.8248 T = 10 T2 = 60 n = 10.4659 T = 15 T2 = 55 n = 10 y = 15 55 T = 21 T2 = 49 n = 9.4121 T = 28 T2 = 42 n = 8.6788

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));

y = [] nmax = 6086 T = 1 T2 = 37052030 n = 8.6079e+03 T = 3 T2 = 37052028 n = 8.6079e+03 T = 6 T2 = 37052025 n = 8.6079e+03 T = 10 T2 = 37052021 n = 8.6079e+03 T = 15 T2 = 37052016 n = 8.6079e+03 T = 21 T2 = 37052010 n = 8.6079e+03 T = 28 T2 = 37052003 n = 8.6079e+03 T = 36 T2 = 37051995 n = 8.6079e+03 T = 45 T2 = 37051986 n = 8.6079e+03 T = 55 T2 = 37051976 n = 8.6079e+03 T = 66 T2 = 37051965 n = 8.6079e+03 T = 78 T2 = 37051953 n = 8.6079e+03 T = 91 T2 = 37051940 n = 8.6079e+03 T = 105 T2 = 37051926 n = 8.6079e+03 T = 120 T2 = 37051911 n = 8.6079e+03 T = 136 T2 = 37051895 n = 8.6079e+03 T = 153 T2 = 37051878 n = 8.6079e+03 T = 171 T2 = 37051860 n = 8.6079e+03 T = 190 T2 = 37051841 n = 8.6078e+03 T = 210 T2 = 37051821 n = 8.6078e+03 T = 231 T2 = 37051800 n = 8.6078e+03 T = 253 T2 = 37051778 n = 8.6078e+03 T = 276 T2 = 37051755 n = 8.6078e+03 T = 300 T2 = 37051731 n = 8.6078e+03 T = 325 T2 = 37051706 n = 8.6078e+03 T = 351 T2 = 37051680 n = 8.6078e+03 T = 378 T2 = 37051653 n = 8.6078e+03 T = 406 T2 = 37051625 n = 8.6078e+03 T = 435 T2 = 37051596 n = 8.6078e+03 T = 465 T2 = 37051566 n = 8.6078e+03 T = 496 T2 = 37051535 n = 8.6078e+03 T = 528 T2 = 37051503 n = 8.6078e+03 T = 561 T2 = 37051470 n = 8.6078e+03 T = 595 T2 = 37051436 n = 8.6078e+03 T = 630 T2 = 37051401 n = 8.6078e+03 T = 666 T2 = 37051365 n = 8.6078e+03 T = 703 T2 = 37051328 n = 8.6078e+03 T = 741 T2 = 37051290 n = 8.6078e+03 T = 780 T2 = 37051251 n = 8.6078e+03 T = 820 T2 = 37051211 n = 8.6078e+03 T = 861 T2 = 37051170 n = 8.6078e+03 T = 903 T2 = 37051128 n = 8.6078e+03 T = 946 T2 = 37051085 n = 8.6078e+03 T = 990 T2 = 37051041 n = 8.6078e+03 T = 1035 T2 = 37050996 n = 8.6078e+03 T = 1081 T2 = 37050950 n = 8.6077e+03 T = 1128 T2 = 37050903 n = 8.6077e+03 T = 1176 T2 = 37050855 n = 8.6077e+03 T = 1225 T2 = 37050806 n = 8.6077e+03 T = 1275 T2 = 37050756 n = 8.6077e+03 T = 1326 T2 = 37050705 n = 8.6077e+03 T = 1378 T2 = 37050653 n = 8.6077e+03 T = 1431 T2 = 37050600 n = 8.6077e+03 T = 1485 T2 = 37050546 n = 8.6077e+03 T = 1540 T2 = 37050491 n = 8.6077e+03 T = 1596 T2 = 37050435 n = 8.6077e+03 T = 1653 T2 = 37050378 n = 8.6077e+03 T = 1711 T2 = 37050320 n = 8.6077e+03 T = 1770 T2 = 37050261 n = 8.6077e+03 T = 1830 T2 = 37050201 n = 8.6077e+03 T = 1891 T2 = 37050140 n = 8.6077e+03 T = 1953 T2 = 37050078 n = 8.6076e+03 T = 2016 T2 = 37050015 n = 8.6076e+03 T = 2080 T2 = 37049951 n = 8.6076e+03 T = 2145 T2 = 37049886 n = 8.6076e+03 T = 2211 T2 = 37049820 n = 8.6076e+03 T = 2278 T2 = 37049753 n = 8.6076e+03 T = 2346 T2 = 37049685 n = 8.6076e+03 T = 2415 T2 = 37049616 n = 8.6076e+03 T = 2485 T2 = 37049546 n = 8.6076e+03 T = 2556 T2 = 37049475 n = 8.6076e+03 T = 2628 T2 = 37049403 n = 8.6076e+03 T = 2701 T2 = 37049330 n = 8.6076e+03 T = 2775 T2 = 37049256 n = 8.6075e+03 T = 2850 T2 = 37049181 n = 8.6075e+03 T = 2926 T2 = 37049105 n = 8.6075e+03 T = 3003 T2 = 37049028 n = 8.6075e+03 T = 3081 T2 = 37048950 n = 8.6075e+03 T = 3160 T2 = 37048871 n = 8.6075e+03 T = 3240 T2 = 37048791 n = 8.6075e+03 T = 3321 T2 = 37048710 n = 8.6075e+03 T = 3403 T2 = 37048628 n = 8.6075e+03 T = 3486 T2 = 37048545 n = 8.6075e+03 T = 3570 T2 = 37048461 n = 8.6075e+03 T = 3655 T2 = 37048376 n = 8.6074e+03 T = 3741 T2 = 37048290 n = 8.6074e+03 T = 3828 T2 = 37048203 n = 8.6074e+03 T = 3916 T2 = 37048115 n = 8.6074e+03 T = 4005 T2 = 37048026 n = 8.6074e+03 T = 4095 T2 = 37047936 n = 8.6074e+03 T = 4186 T2 = 37047845 n = 8.6074e+03 T = 4278 T2 = 37047753 n = 8.6074e+03 T = 4371 T2 = 37047660 n = 8.6074e+03 T = 4465 T2 = 37047566 n = 8.6074e+03 T = 4560 T2 = 37047471 n = 8.6073e+03 T = 4656 T2 = 37047375 n = 8.6073e+03 T = 4753 T2 = 37047278 n = 8.6073e+03 T = 4851 T2 = 37047180 n = 8.6073e+03 T = 4950 T2 = 37047081 n = 8.6073e+03 T = 5050 T2 = 37046981 n = 8.6073e+03 T = 5151 T2 = 37046880 n = 8.6073e+03 T = 5253 T2 = 37046778 n = 8.6073e+03 T = 5356 T2 = 37046675 n = 8.6072e+03 T = 5460 T2 = 37046571 n = 8.6072e+03 T = 5565 T2 = 37046466 n = 8.6072e+03 T = 5671 T2 = 37046360 n = 8.6072e+03 T = 5778 T2 = 37046253 n = 8.6072e+03 T = 5886 T2 = 37046145 n = 8.6072e+03 T = 5995 T2 = 37046036 n = 8.6072e+03 T = 6105 T2 = 37045926 n = 8.6072e+03 T = 6216 T2 = 37045815 n = 8.6071e+03 T = 6328 T2 = 37045703 n = 8.6071e+03 T = 6441 T2 = 37045590 n = 8.6071e+03 T = 6555 T2 = 37045476 n = 8.6071e+03 T = 6670 T2 = 37045361 n = 8.6071e+03 T = 6786 T2 = 37045245 n = 8.6071e+03 T = 6903 T2 = 37045128 n = 8.6071e+03 T = 7021 T2 = 37045010 n = 8.6071e+03 T = 7140 T2 = 37044891 n = 8.6070e+03 T = 7260 T2 = 37044771 n = 8.6070e+03 T = 7381 T2 = 37044650 n = 8.6070e+03 T = 7503 T2 = 37044528 n = 8607 y = 7503 37044528 T = 7626 T2 = 37044405 n = 8.6070e+03 T = 7750 T2 = 37044281 n = 8.6070e+03 T = 7875 T2 = 37044156 n = 8.6070e+03 T = 8001 T2 = 37044030 n = 8.6069e+03 T = 8128 T2 = 37043903 n = 8.6069e+03 T = 8256 T2 = 37043775 n = 8.6069e+03 T = 8385 T2 = 37043646 n = 8.6069e+03 T = 8515 T2 = 37043516 n = 8.6069e+03 T = 8646 T2 = 37043385 n = 8.6069e+03 T = 8778 T2 = 37043253 n = 8.6069e+03 T = 8911 T2 = 37043120 n = 8.6068e+03 T = 9045 T2 = 37042986 n = 8.6068e+03 T = 9180 T2 = 37042851 n = 8.6068e+03 T = 9316 T2 = 37042715 n = 8.6068e+03 T = 9453 T2 = 37042578 n = 8.6068e+03 T = 9591 T2 = 37042440 n = 8.6068e+03 T = 9730 T2 = 37042301 n = 8.6067e+03 T = 9870 T2 = 37042161 n = 8.6067e+03 T = 10011 T2 = 37042020 n = 8.6067e+03 T = 10153 T2 = 37041878 n = 8.6067e+03 T = 10296 T2 = 37041735 n = 8.6067e+03 T = 10440 T2 = 37041591 n = 8.6067e+03 T = 10585 T2 = 37041446 n = 8.6066e+03 T = 10731 T2 = 37041300 n = 8.6066e+03 T = 10878 T2 = 37041153 n = 8.6066e+03 T = 11026 T2 = 37041005 n = 8.6066e+03 T = 11175 T2 = 37040856 n = 8.6066e+03 T = 11325 T2 = 37040706 n = 8.6066e+03 T = 11476 T2 = 37040555 n = 8.6065e+03 T = 11628 T2 = 37040403 n = 8.6065e+03 T = 11781 T2 = 37040250 n = 8.6065e+03 T = 11935 T2 = 37040096 n = 8.6065e+03 T = 12090 T2 = 37039941 n = 8.6065e+03 T = 12246 T2 = 37039785 n = 8.6064e+03 T = 12403 T2 = 37039628 n = 8.6064e+03 T = 12561 T2 = 37039470 n = 8.6064e+03 T = 12720 T2 = 37039311 n = 8.6064e+03 T = 12880 T2 = 37039151 n = 8.6064e+03 T = 13041 T2 = 37038990 n = 8.6064e+03 T = 13203 T2 = 37038828 n = 8.6063e+03 T = 13366 T2 = 37038665 n = 8.6063e+03 T = 13530 T2 = 37038501 n = 8.6063e+03 T = 13695 T2 = ...

### Community Treasure Hunt

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

Start Hunting!