Cody

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

Solution 1764303

Submitted on 27 Mar 2019 by Oliver Waddington
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 = 0 b = 3025 a = 1 a = 5 a = 14 a = 30 a = 55 a = 91 a = 140 a = 204 a = 285 a = 385 y = 2640

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

a = 0 b = 44100 a = 1 a = 5 a = 14 a = 30 a = 55 a = 91 a = 140 a = 204 a = 285 a = 385 a = 506 a = 650 a = 819 a = 1015 a = 1240 a = 1496 a = 1785 a = 2109 a = 2470 a = 2870 y = 41230

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

a = 0 b = 404010000 a = 1 a = 5 a = 14 a = 30 a = 55 a = 91 a = 140 a = 204 a = 285 a = 385 a = 506 a = 650 a = 819 a = 1015 a = 1240 a = 1496 a = 1785 a = 2109 a = 2470 a = 2870 a = 3311 a = 3795 a = 4324 a = 4900 a = 5525 a = 6201 a = 6930 a = 7714 a = 8555 a = 9455 a = 10416 a = 11440 a = 12529 a = 13685 a = 14910 a = 16206 a = 17575 a = 19019 a = 20540 a = 22140 a = 23821 a = 25585 a = 27434 a = 29370 a = 31395 a = 33511 a = 35720 a = 38024 a = 40425 a = 42925 a = 45526 a = 48230 a = 51039 a = 53955 a = 56980 a = 60116 a = 63365 a = 66729 a = 70210 a = 73810 a = 77531 a = 81375 a = 85344 a = 89440 a = 93665 a = 98021 a = 102510 a = 107134 a = 111895 a = 116795 a = 121836 a = 127020 a = 132349 a = 137825 a = 143450 a = 149226 a = 155155 a = 161239 a = 167480 a = 173880 a = 180441 a = 187165 a = 194054 a = 201110 a = 208335 a = 215731 a = 223300 a = 231044 a = 238965 a = 247065 a = 255346 a = 263810 a = 272459 a = 281295 a = 290320 a = 299536 a = 308945 a = 318549 a = 328350 a = 338350 a = 348551 a = 358955 a = 369564 a = 380380 a = 391405 a = 402641 a = 414090 a = 425754 a = 437635 a = 449735 a = 462056 a = 474600 a = 487369 a = 500365 a = 513590 a = 527046 a = 540735 a = 554659 a = 568820 a = 583220 a = 597861 a = 612745 a = 627874 a = 643250 a = 658875 a = 674751 a = 690880 a = 707264 a = 723905 a = 740805 a = 757966 a = 775390 a = 793079 a = 811035 a = 829260 a = 847756 a = 866525 a = 885569 a = 904890 a = 924490 a = 944371 a = 964535 a = 984984 a = 1005720 a = 1026745 a = 1048061 a = 1069670 a = 1091574 a = 1113775 a = 1136275 a = 1159076 a = 1182180 a = 1205589 a = 1229305 a = 1253330 a = 1277666 a = 1302315 a = 1327279 a = 1352560 a = 1378160 a = 1404081 a = 1430325 a = 1456894 a = 1483790 a = 1511015 a = 1538571 a = 1566460 a = 1594684 a = 1623245 a = 1652145 a = 1681386 a = 1710970 a = 1740899 a = 1771175 a = 1801800 a = 1832776 a = 1864105 a = 1895789 a = 1927830 a = 1960230 a = 1992991 a = 2026115 a = 2059604 a = 2093460 a = 2127685 a = 2162281 a = 2197250 a = 2232594 a = 2268315 a = 2304415 a = 2340896 a = 2377760 a = 2415009 a = 2452645 a = 2490670 a = 2529086 a = 2567895 a = 2607099 a = 2646700 a = 2686700 y = 401323300