Cody

# Problem 44334. Sums of Multiple Pairs of Triangular Numbers

Solution 1310747

Submitted on 23 Oct 2017 by Anselm Karl
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))

n2 = 5.8443 n2 = 5.5208 n2 = 5 n2 = 4.2170

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

n2 = 12.1590 n2 = 12 n2 = 11.7577 n2 = 11.4269 n2 = 11 n2 = 10.4659 n2 = 9.8078 n2 = 9

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

n2 = 5.6847 n2 = 5.3523 n2 = 4.8151 n2 = 4

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

n2 = 189 n2 = 188.9894 n2 = 188.9736 n2 = 188.9525 n2 = 188.9261 n2 = 188.8944 n2 = 188.8575 n2 = 188.8152 n2 = 188.7677 n2 = 188.7148 n2 = 188.6567 n2 = 188.5932 n2 = 188.5245 n2 = 188.4504 n2 = 188.3710 n2 = 188.2863 n2 = 188.1962 n2 = 188.1008 n2 = 188 n2 = 187.8939 n2 = 187.7824 n2 = 187.6655 n2 = 187.5432 n2 = 187.4155 n2 = 187.2825 n2 = 187.1439 n2 = 187 n2 = 186.8506 n2 = 186.6958 n2 = 186.5354 n2 = 186.3696 n2 = 186.1983 n2 = 186.0214 n2 = 185.8391 n2 = 185.6511 n2 = 185.4577 n2 = 185.2586 n2 = 185.0539 n2 = 184.8436 n2 = 184.6277 n2 = 184.4061 n2 = 184.1788 n2 = 183.9458 n2 = 183.7071 n2 = 183.4626 n2 = 183.2124 n2 = 182.9564 n2 = 182.6946 n2 = 182.4269 n2 = 182.1534 n2 = 181.8739 n2 = 181.5886 n2 = 181.2973 n2 = 181 n2 = 180.6967 n2 = 180.3874 n2 = 180.0720 n2 = 179.7505 n2 = 179.4229 n2 = 179.0891 n2 = 178.7491 n2 = 178.4029 n2 = 178.0504 n2 = 177.6916 n2 = 177.3265 n2 = 176.9549 n2 = 176.5770 n2 = 176.1925 n2 = 175.8016 n2 = 175.4041 n2 = 175 n2 = 174.5893 n2 = 174.1718 n2 = 173.7477 n2 = 173.3167 n2 = 172.8789 n2 = 172.4342 n2 = 171.9826 n2 = 171.5240 n2 = 171.0583 n2 = 170.5855 n2 = 170.1055 n2 = 169.6183 n2 = 169.1238 n2 = 168.6220 n2 = 168.1127 n2 = 167.5960 n2 = 167.0716 n2 = 166.5397 n2 = 166 n2 = 165.4526 n2 = 164.8972 n2 = 164.3340 n2 = 163.7627 n2 = 163.1834 n2 = 162.5958 n2 = 162 n2 = 161.3958 n2 = 160.7831 n2 = 160.1619 n2 = 159.5320 n2 = 158.8934 n2 = 158.2459 n2 = 157.5894 n2 = 156.9238 n2 = 156.2490 n2 = 155.5649 n2 = 154.8713 n2 = 154.1682 n2 = 153.4554 n2 = 152.7327 n2 = 152 n2 = 151.2572 n2 = 150.5041 n2 = 149.7406 n2 = 148.9666 n2 = 148.1817 n2 = 147.3859 n2 = 146.5791 n2 = 145.7609 n2 = 144.9313 n2 = 144.0899 n2 = 143.2367 n2 = 142.3714 n2 = 141.4938 n2 = 140.6037 n2 = 139.7007 n2 = 138.7848 n2 = 137.8555 n2 = 136.9127 n2 = 135.9560 n2 = 134.9852 n2 = 134

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

n2 = 11.2580 n2 = 11.0866 n2 = 10.8248 n2 = 10.4659 n2 = 10 n2 = 9.4121 n2 = 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));

n2 = 8.6079e+03 n2 = 8.6079e+03 n2 = 8.6079e+03 n2 = 8.6079e+03 n2 = 8.6079e+03 n2 = 8.6079e+03 n2 = 8.6079e+03 n2 = 8.6079e+03 n2 = 8.6079e+03 n2 = 8.6079e+03 n2 = 8.6079e+03 n2 = 8.6079e+03 n2 = 8.6079e+03 n2 = 8.6079e+03 n2 = 8.6079e+03 n2 = 8.6079e+03 n2 = 8.6079e+03 n2 = 8.6079e+03 n2 = 8.6078e+03 n2 = 8.6078e+03 n2 = 8.6078e+03 n2 = 8.6078e+03 n2 = 8.6078e+03 n2 = 8.6078e+03 n2 = 8.6078e+03 n2 = 8.6078e+03 n2 = 8.6078e+03 n2 = 8.6078e+03 n2 = 8.6078e+03 n2 = 8.6078e+03 n2 = 8.6078e+03 n2 = 8.6078e+03 n2 = 8.6078e+03 n2 = 8.6078e+03 n2 = 8.6078e+03 n2 = 8.6078e+03 n2 = 8.6078e+03 n2 = 8.6078e+03 n2 = 8.6078e+03 n2 = 8.6078e+03 n2 = 8.6078e+03 n2 = 8.6078e+03 n2 = 8.6078e+03 n2 = 8.6078e+03 n2 = 8.6078e+03 n2 = 8.6077e+03 n2 = 8.6077e+03 n2 = 8.6077e+03 n2 = 8.6077e+03 n2 = 8.6077e+03 n2 = 8.6077e+03 n2 = 8.6077e+03 n2 = 8.6077e+03 n2 = 8.6077e+03 n2 = 8.6077e+03 n2 = 8.6077e+03 n2 = 8.6077e+03 n2 = 8.6077e+03 n2 = 8.6077e+03 n2 = 8.6077e+03 n2 = 8.6077e+03 n2 = 8.6076e+03 n2 = 8.6076e+03 n2 = 8.6076e+03 n2 = 8.6076e+03 n2 = 8.6076e+03 n2 = 8.6076e+03 n2 = 8.6076e+03 n2 = 8.6076e+03 n2 = 8.6076e+03 n2 = 8.6076e+03 n2 = 8.6076e+03 n2 = 8.6076e+03 n2 = 8.6075e+03 n2 = 8.6075e+03 n2 = 8.6075e+03 n2 = 8.6075e+03 n2 = 8.6075e+03 n2 = 8.6075e+03 n2 = 8.6075e+03 n2 = 8.6075e+03 n2 = 8.6075e+03 n2 = 8.6075e+03 n2 = 8.6075e+03 n2 = 8.6074e+03 n2 = 8.6074e+03 n2 = 8.6074e+03 n2 = 8.6074e+03 n2 = 8.6074e+03 n2 = 8.6074e+03 n2 = 8.6074e+03 n2 = 8.6074e+03 n2 = 8.6074e+03 n2 = 8.6074e+03 n2 = 8.6073e+03 n2 = 8.6073e+03 n2 = 8.6073e+03 n2 = 8.6073e+03 n2 = 8.6073e+03 n2 = 8.6073e+03 n2 = 8.6073e+03 n2 = 8.6073e+03 n2 = 8.6072e+03 n2 = 8.6072e+03 n2 = 8.6072e+03 n2 = 8.6072e+03 n2 = 8.6072e+03 n2 = 8.6072e+03 n2 = 8.6072e+03 n2 = 8.6072e+03 n2 = 8.6071e+03 n2 = 8.6071e+03 n2 = 8.6071e+03 n2 = 8.6071e+03 n2 = 8.6071e+03 n2 = 8.6071e+03 n2 = 8.6071e+03 n2 = 8.6071e+03 n2 = 8.6070e+03 n2 = 8.6070e+03 n2 = 8.6070e+03 n2 = 8607 n2 = 8.6070e+03 n2 = 8.6070e+03 n2 = 8.6070e+03 n2 = 8.6069e+03 n2 = 8.6069e+03 n2 = 8.6069e+03 n2 = 8.6069e+03 n2 = 8.6069e+03 n2 = 8.6069e+03 n2 = 8.6069e+03 n2 = 8.6068e+03 n2 = 8.6068e+03 n2 = 8.6068e+03 n2 = 8.6068e+03 n2 = 8.6068e+03 n2 = 8.6068e+03 n2 = 8.6067e+03 n2 = 8.6067e+03 n2 = 8.6067e+03 n2 = 8.6067e+03 n2 = 8.6067e+03 n2 = 8.6067e+03 n2 = 8.6066e+03 n2 = 8.6066e+03 n2 = 8.6066e+03 n2 = 8.6066e+03 n2 = 8.6066e+03 n2 = 8.6066e+03 n2 = 8.6065e+03 n2 = 8.6065e+03 n2 = 8.6065e+03 n2 = 8.6065e+03 n2 = 8.6065e+03 n2 = 8.6064e+03 n2 = 8.6064e+03 n2 = 8.6064e+03 n2 = 8.6064e+03 n2 = 8.6064e+03 n2 = 8.6064e+03 n2 = 8.6063e+03 n2 = 8.6063e+03 n2 = 8.6063e+03 n2 = 8.6063e+03 n2 = 8.6063e+03 n2 = 8.6062e+03 n2 = 8.6062e+03 n2 = 8.6062e+03 n2 = 8.6062e+03 n2 = 8.6062e+03 n2 = 8.6061e+03 n2 = 8.6061e+03 n2 = 8.6061e+03 n2 = 8.6061e+03 n2 = 8.6061e+03 n2 = 8.6060e+03 n2 = 8.6060e+03 n2 = 8606 n2 = 8.6060e+03 n2 = 8.6060e+03 n2 = 8.6059e+03 n2 = 8.6059e+03 n2 = 8.6059e+03 n2 = 8.6059e+03 n2 = 8.6059e+03 n2 = 8.6058e+03 n2 = 8.6058e+03 n2 = 8.6058e+03 n2 = 8.6058e+03 n2 = 8.6057e+03 n2 = 8.6057e+03 n2 = 8.6057e+03 n2 = 8.6057e+03 n2 = 8.6057e+03 n2 = 8.6056e+03 n2 = 8.6056e+03 n2 = 8.6056e+03 n2 = 8.6056e+03 n2 = 8.6055e+03 n2 = 8.6055e+03 n2 = 8.6055e+03 n2 = 8.6055e+03 n2 = 8.6054e+03 n2 = 8.6054e+03 n2 = 8.6054e+03 n2 = 8.6054e+03 n2 = 8.6053e+03 n2 = 8.6053e+03 n2 = 8.6053e+03 n2 = 8.6053e+03 n2 = 8.6052e+03 n2 = 8.6052e+03 n2 = 8.6052e+03 n2 = 8.6052e+03 n2 = 8.6051e+03 n2 = 8.6051e+03 n2 = 8.6051e+03 n2 = 8.6051e+03 n2 = 8.6050e+03 n2 = 8.6050e+03 n2 = 8.6050e+03 n2 = 8.6050e+03 n2 = 8.6049e+03 n2 = 8.6049e+03 n2 = 8.6049e+03 n2 = 8.6049e+03 n2 = 8.6048e+03 n2 = 8.6048e+03 n2 = 8.6048e+03 n2 = 8.6048e+03 n2 = 8.6047e+03 n2 = 8.6047e+03 n2 = 8.6047e+03 n2 = 8.6046e+03 n2 = 8.6046e+03 n2 = 8.6046e+03 n2 = 8.6046e+03 n2 = 8.6045e+03 n2 = 8.6045e+03 n2 = 8.6045e+03 n2 = 8.6045e+03 n2 = 8.6044e+03 n2 = 8.6044e+03 n2 = 8.6044e+03 n2 = 8.6043e+03 n2 = 8.6043e+03 n2 = 8.6043e+03 n2 = 8.6043e+03 n2 = 8.6042e+03 n2 = 8.6042e+03 n2 = 8.6042e+03 n2 = 8.6041e+03 n2 = 8.6041e+03 n2 = 8.6041e+03 n2 = 8.6040e+03 n2 = 8.6040e+03 n2 = 8.6040e+03 n2 = 8.6040e+03 n2 = 8.6039e+03 n2 = 8.6039e+03 n2 = 8.6039e+03 n2 = 8.6038e+03 n2 = 8.6038e+03 n2 = 8.6038e+03 n2 = 8.6037e+03 n2 = 8.6037e+03 n2 = 8.6037e+03 n2 = 8.6037e+03 n2 = 8.6036e+03 n2 = 8.6036e+03 n2 = 8.6036e+03 n2 = 8.6035e+03 n2 = 8.6035e+03 n2 = 8.6035e+03 n2 = 8.6034e+03 n2 = 8.6034e+03 n2 = 8.6034e+03 n2 = 8.6033e+03 n2 = 8.6033e+03 n2 = 8.6033e+03 n2 = 8.6032e+03 n2 = 8.6032e+03 n2 = 8.6032e+03 n2 = 8.6031e+03 n2 = 8.6031e+03 n2 = 8.6031e+03 n2 = 8.6030e+03 n2 = 8.6030e+03 n2 = 8.6030e+03 n2 = 8.6029e+03 n2 = 8.6029e+03 n2 = 8.6029e+03 n2 = 8.6028e+03 n2 = 8.6028e+03 n2 = 8.6028e+03 n2 = 8.6027e+03 n2 = 8.6027e+03 n2 = 8.6027e+03 n2 = 8.6026e+03 n2 = 8.6026e+03 n2 = 8.6026e+03 n2 = 8.6025e+03 n2 = 8.6025e+03 n2 = 8.6024e+03 n2 = 8.6024e+03 n2 = 8.6024e+03 n2 = 8.6023e+03 n2 = 8.6023e+03 n2 = 8.6023e+03 n2 = 8.6022e+03 n2 = 8.6022e+03 n2 = 8.6022e+03 n2 = 8.6021e+03 n2 = 8.6021e+03 n2 = 8.6021e+03 n2 = 8.6020e+03 n2 = 8.6020e+03 n2 = 8.6019e+03 n2 = 8.6019e+03 n2 = 8.6019e+03 n2 = 8.6018e+03 n2 = 8.6018e+03 n2 = 8.6018e+03 n2 = 8.6017e+03 n2 = 8.6017e+03 n2 = 8.6016e+03 n2 = 8.6016e+03 n2 = 8.6016e+03 n2 = 8.6015e+03 n2 = 8.6015e+03 n2 = 8.6014e+03 n2 = 8.6014e+03 n2 = 8.6014e+03 n2 = 8.6013e+03 n2 = 8.6013e+03 n2 = 8.6013e+03 n2 = 8.6012e+03 n2 = 8.6012e+03 n2 = 8.6011e+03 n2 = 8.6011e+03 n2 = 8.6011e+03 n2 = 8.6010e+03 n2 = 8.6010e+03 n2 = 8.6009e+03 n2 = 8.6009e+03 n2 = 8.6009e+03 n2 = 8.6008e+03 n2 = 8.6008e+03 n2 = 8.6007e+03 n2 = 8.6007e+03 n2 = 8.6007e+03 n2 = 8.6006e+03 n2 = 8.6006e+03 n2 = 8.6005e+03 n2 = 8.6005e+03 n2 = 8.6004e+03 n2 = 8.6004e+03 n2 = 8.6004e+03 n2 = 8.6003e+03 n2 = 8.6003e+03 n2 = 8.6002e+03 n2 = 8.6002e+03 n2 = 8.6002e+03 n2 = 8.6001e+03 n2 = 8.6001e+03 n2 = 8.6000e+03 n2 = 8.6000e+03 n2 = 8.5999e+03 n2 = 8.5999e+03 n2 = 8.5999e+03 n2 = 8.5998e+03 n2 = 8.5998e+03 n2 = 8.5997e+03 n2 = 8.5997e+03 n2 = 8.5996e+03 n2 = 8.5996e+03 n2 = 8.5995e+03 n2 = 8.5995e+03 n2 = 8.5995e+03 n2 = 8.5994e+03 n2 = 8.5994e+03 n2 = 8.5993e+03 n2 = 8.5993e+03 n2 = 8.5992e+03 n2 = 8.5992e+03 n2 = 8.5991e+03 n2 = 8.5991e+03 n2 = 8.5991e+03 n2 = 8.5990e+03 n2 = 8.5990e+03 n2 = 8.5989e+03 n2 = 8.5989e+03 n2 = 8.5988e+03 n2 = 8.5988e+03 n2 = 8.5987e+03 n2 = 8.5987e+03 n2 = 8.5986e+03 n2 = 8.5986e+03 n2 = 8.5986e+03 n2 = 8.5985e+03 n2 = 8.5985e+03 n2 = 8.5984e+03 n2 = 8.5984e+03 n2 = 8.5983e+03 n2 = 8.5983e+03 n2 = 8.5982e+03 n2 = 8.5982e+03 n2 = 8.5981e+03 n2 = 8.5981e+03 n2 = 8.5980e+03 n2 = 8.5980e+03 n2 = 8.5979e+03 n2 = 8.5979e+03 n2 = 8.5978e+03 n2 = 8.5978e+03 n2 = 8.5977e+03 n2 = 8.5977e+03 n2 = 8.5976e+03 n2 = 8.5976e+03 n2 = 8.5975e+03 n2 = 8.5975e+03 n2 = 8.5974e+03 n2 = 8.5974e+03 n2 = 8.5973e+03 n2 = 8.5973e+03 n2 = 8.5973e+03 n2 = 8.5972e+03 n2 = 8.5972e+03 n2 = 8.5971e+03 n2 = 8.5971e+03 n2 = 8597 n2 = 8.5969e+03 n2 = 8.5969e+03 n2 = 8.5968e+03 n2 = 8.5968e+03 n2 = 8.5967e+03 n2 = 8.5967e+03 n2 = 8.5966e+03 n2 = 8.5966e+03 n2 = 8.5965e+03 n2 = 8.5965e+03 n2 = 8.5964e+03 n2 = 8.5964e+03 n2 = 8.5963e+03 n2 = 8.5963e+03 n2 = 8.5962e+03 n2 = 8.5962e+03 n2 = 8.5961e+03 n2 = 8.5961e+03 n2 = 8.5960e+03 n2 = 8.5960e+03 n2 = 8.5959e+03 n2 = 8.5959e+03 n2 = 8.5958...

### Community Treasure Hunt

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

Start Hunting!