Cody

# Problem 240. Project Euler: Problem 6, Natural numbers, squares and sums.

Solution 1584727

Submitted on 16 Jul 2018 by Ankith Rathod
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 = 10; y_correct = 2640; assert(isequal(euler006(x),y_correct))

a = 1 4 9 16 25 36 49 64 81 100 b = 1 2 3 4 5 6 7 8 9 10 z = 0 c = 0 z = 1 c = 1 z = 5 c = 3 z = 14 c = 6 z = 30 c = 10 z = 55 c = 15 z = 91 c = 21 z = 140 c = 28 z = 204 c = 36 z = 285 c = 45 z = 385 c = 55 c = 3025 y = 2640

2   Pass
x = 20; y_correct = 41230; assert(isequal(euler006(x),y_correct))

a = 1 4 9 16 25 36 49 64 81 100 121 144 169 196 225 256 289 324 361 400 b = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 z = 0 c = 0 z = 1 c = 1 z = 5 c = 3 z = 14 c = 6 z = 30 c = 10 z = 55 c = 15 z = 91 c = 21 z = 140 c = 28 z = 204 c = 36 z = 285 c = 45 z = 385 c = 55 z = 506 c = 66 z = 650 c = 78 z = 819 c = 91 z = 1015 c = 105 z = 1240 c = 120 z = 1496 c = 136 z = 1785 c = 153 z = 2109 c = 171 z = 2470 c = 190 z = 2870 c = 210 c = 44100 y = 41230

3   Pass
x = 200; y_correct = 401323300; assert(isequal(euler006(x),y_correct))

a = Columns 1 through 15 1 4 9 16 25 36 49 64 81 100 121 144 169 196 225 Columns 16 through 30 256 289 324 361 400 441 484 529 576 625 676 729 784 841 900 Columns 31 through 45 961 1024 1089 1156 1225 1296 1369 1444 1521 1600 1681 1764 1849 1936 2025 Columns 46 through 60 2116 2209 2304 2401 2500 2601 2704 2809 2916 3025 3136 3249 3364 3481 3600 Columns 61 through 75 3721 3844 3969 4096 4225 4356 4489 4624 4761 4900 5041 5184 5329 5476 5625 Columns 76 through 90 5776 5929 6084 6241 6400 6561 6724 6889 7056 7225 7396 7569 7744 7921 8100 Columns 91 through 105 8281 8464 8649 8836 9025 9216 9409 9604 9801 10000 10201 10404 10609 10816 11025 Columns 106 through 120 11236 11449 11664 11881 12100 12321 12544 12769 12996 13225 13456 13689 13924 14161 14400 Columns 121 through 135 14641 14884 15129 15376 15625 15876 16129 16384 16641 16900 17161 17424 17689 17956 18225 Columns 136 through 150 18496 18769 19044 19321 19600 19881 20164 20449 20736 21025 21316 21609 21904 22201 22500 Columns 151 through 165 22801 23104 23409 23716 24025 24336 24649 24964 25281 25600 25921 26244 26569 26896 27225 Columns 166 through 180 27556 27889 28224 28561 28900 29241 29584 29929 30276 30625 30976 31329 31684 32041 32400 Columns 181 through 195 32761 33124 33489 33856 34225 34596 34969 35344 35721 36100 36481 36864 37249 37636 38025 Columns 196 through 200 38416 38809 39204 39601 40000 b = Columns 1 through 30 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 Columns 31 through 60 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 Columns 61 through 90 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 Columns 91 through 120 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 Columns 121 through 150 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 Columns 151 through 180 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 Columns 181 through 200 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 z = 0 c = 0 z = 1 c = 1 z = 5 c = 3 z = 14 c = 6 z = 30 c = 10 z = 55 c = 15 z = 91 c = 21 z = 140 c = 28 z = 204 c = 36 z = 285 c = 45 z = 385 c = 55 z = 506 c = 66 z = 650 c = 78 z = 819 c = 91 z = 1015 c = 105 z = 1240 c = 120 z = 1496 c = 136 z = 1785 c = 153 z = 2109 c = 171 z = 2470 c = 190 z = 2870 c = 210 z = 3311 c = 231 z = 3795 c = 253 z = 4324 c = 276 z = 4900 c = 300 z = 5525 c = 325 z = 6201 c = 351 z = 6930 c = 378 z = 7714 c = 406 z = 8555 c = 435 z = 9455 c = 465 z = 10416 c = 496 z = 11440 c = 528 z = 12529 c = 561 z = 13685 c = 595 z = 14910 c = 630 z = 16206 c = 666 z = 17575 c = 703 z = 19019 c = 741 z = 20540 c = 780 z = 22140 c = 820 z = 23821 c = 861 z = 25585 c = 903 z = 27434 c = 946 z = 29370 c = 990 z = 31395 c = 1035 z = 33511 c = 1081 z = 35720 c = 1128 z = 38024 c = 1176 z = 40425 c = 1225 z = 42925 c = 1275 z = 45526 c = 1326 z = 48230 c = 1378 z = 51039 c = 1431 z = 53955 c = 1485 z = 56980 c = 1540 z = 60116 c = 1596 z = 63365 c = 1653 z = 66729 c = 1711 z = 70210 c = 1770 z = 73810 c = 1830 z = 77531 c = 1891 z = 81375 c = 1953 z = 85344 c = 2016 z = 89440 c = 2080 z = 93665 c = 2145 z = 98021 c = 2211 z = 102510 c = 2278 z = 107134 c = 2346 z = 111895 c = 2415 z = 116795 c = 2485 z = 121836 c = 2556 z = 127020 c = 2628 z = 132349 c = 2701 z = 137825 c = 2775 z = 143450 c = 2850 z = 149226 c = 2926 z = 155155 c = 3003 z = 161239 c = 3081 z = 167480 c = 3160 z = 173880 c = 3240 z = 180441 c = 3321 z = 187165 c = 3403 z = 194054 c = 3486 z = 201110 c = 3570 z = 208335 c = 3655 z = 215731 c = 3741 z = 223300 c = 3828 z = 231044 c = 3916 z = 238965 c = 4005 z = 247065 c = 4095 z = 255346 c = 4186 z = 263810 c = 4278 z = 272459 c = 4371 z = 281295 c = 4465 z = 290320 c = 4560 z = 299536 c = 4656 z = 308945 c = 4753 z = 318549 c = 4851 z = 328350 c = 4950 z = 338350 c = 5050 z = 348551 c = 5151 z = 358955 c = 5253 z = 369564 c = 5356 z = 380380 c = 5460 z = 391405 c = 5565 z = 402641 c = 5671 z = 414090 c = 5778 z = 425754 c = 5886 z = 437635 c = 5995 z = 449735 c = 6105 z = 462056 c = 6216 z = 474600 c = 6328 z = 487369 c = 6441 z = 500365 c = 6555 z = 513590 c = 6670 z = 527046 c = 6786 z = 540735 c = 6903 z = 554659 c = 7021 z = 568820 c = 7140 z = 583220 c = 7260 z = 597861 c = 7381 z = 612745 c = 7503 z = 627874 c = 7626 z = 643250 c = 7750 z = 658875 c = 7875 z = 674751 c = 8001 z = 690880 c = 8128 z = 707264 c = 8256 z = 723905 c = 8385 z = 740805 c = 8515 z = 757966 c = 8646 z = 775390 c = 8778 z = 793079 c = 8911 z = 811035 c = 9045 z = 829260 c = 9180 z = 847756 c = 9316 z = 866525 c = 9453 z = 885569 c = 9591 z = 904890 c = 9730 z = 924490 c = 9870 z = 944371 c = 10011 z = 964535 c = 10153 z = 984984 c = 10296 z = 1005720 c = 10440 z = 1026745 c = 10585 z = 1048061 c = 10731 z = 1069670 c = 10878 z = 1091574 c = 11026 z = 1113775 c = 11175 z = 1136275 c = 11325 z = 1159076 c = 11476 z = 1182180 c = 11628 z = 1205589 c = 117...