Cody

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

Solution 1946078

Submitted on 23 Sep 2019 by Vu Thanh Nam
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 = 0 a = 1 b = 1 y = 0 a = 5 b = 3 y = 4 a = 14 b = 6 y = 22 a = 30 b = 10 y = 70 a = 55 b = 15 y = 170 a = 91 b = 21 y = 350 a = 140 b = 28 y = 644 a = 204 b = 36 y = 1092 a = 285 b = 45 y = 1740 a = 385 b = 55 y = 2640

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

a = 0 b = 0 a = 1 b = 1 y = 0 a = 5 b = 3 y = 4 a = 14 b = 6 y = 22 a = 30 b = 10 y = 70 a = 55 b = 15 y = 170 a = 91 b = 21 y = 350 a = 140 b = 28 y = 644 a = 204 b = 36 y = 1092 a = 285 b = 45 y = 1740 a = 385 b = 55 y = 2640 a = 506 b = 66 y = 3850 a = 650 b = 78 y = 5434 a = 819 b = 91 y = 7462 a = 1015 b = 105 y = 10010 a = 1240 b = 120 y = 13160 a = 1496 b = 136 y = 17000 a = 1785 b = 153 y = 21624 a = 2109 b = 171 y = 27132 a = 2470 b = 190 y = 33630 a = 2870 b = 210 y = 41230

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

a = 0 b = 0 a = 1 b = 1 y = 0 a = 5 b = 3 y = 4 a = 14 b = 6 y = 22 a = 30 b = 10 y = 70 a = 55 b = 15 y = 170 a = 91 b = 21 y = 350 a = 140 b = 28 y = 644 a = 204 b = 36 y = 1092 a = 285 b = 45 y = 1740 a = 385 b = 55 y = 2640 a = 506 b = 66 y = 3850 a = 650 b = 78 y = 5434 a = 819 b = 91 y = 7462 a = 1015 b = 105 y = 10010 a = 1240 b = 120 y = 13160 a = 1496 b = 136 y = 17000 a = 1785 b = 153 y = 21624 a = 2109 b = 171 y = 27132 a = 2470 b = 190 y = 33630 a = 2870 b = 210 y = 41230 a = 3311 b = 231 y = 50050 a = 3795 b = 253 y = 60214 a = 4324 b = 276 y = 71852 a = 4900 b = 300 y = 85100 a = 5525 b = 325 y = 100100 a = 6201 b = 351 y = 117000 a = 6930 b = 378 y = 135954 a = 7714 b = 406 y = 157122 a = 8555 b = 435 y = 180670 a = 9455 b = 465 y = 206770 a = 10416 b = 496 y = 235600 a = 11440 b = 528 y = 267344 a = 12529 b = 561 y = 302192 a = 13685 b = 595 y = 340340 a = 14910 b = 630 y = 381990 a = 16206 b = 666 y = 427350 a = 17575 b = 703 y = 476634 a = 19019 b = 741 y = 530062 a = 20540 b = 780 y = 587860 a = 22140 b = 820 y = 650260 a = 23821 b = 861 y = 717500 a = 25585 b = 903 y = 789824 a = 27434 b = 946 y = 867482 a = 29370 b = 990 y = 950730 a = 31395 b = 1035 y = 1039830 a = 33511 b = 1081 y = 1135050 a = 35720 b = 1128 y = 1236664 a = 38024 b = 1176 y = 1344952 a = 40425 b = 1225 y = 1460200 a = 42925 b = 1275 y = 1582700 a = 45526 b = 1326 y = 1712750 a = 48230 b = 1378 y = 1850654 a = 51039 b = 1431 y = 1996722 a = 53955 b = 1485 y = 2151270 a = 56980 b = 1540 y = 2314620 a = 60116 b = 1596 y = 2487100 a = 63365 b = 1653 y = 2669044 a = 66729 b = 1711 y = 2860792 a = 70210 b = 1770 y = 3062690 a = 73810 b = 1830 y = 3275090 a = 77531 b = 1891 y = 3498350 a = 81375 b = 1953 y = 3732834 a = 85344 b = 2016 y = 3978912 a = 89440 b = 2080 y = 4236960 a = 93665 b = 2145 y = 4507360 a = 98021 b = 2211 y = 4790500 a = 102510 b = 2278 y = 5086774 a = 107134 b = 2346 y = 5396582 a = 111895 b = 2415 y = 5720330 a = 116795 b = 2485 y = 6058430 a = 121836 b = 2556 y = 6411300 a = 127020 b = 2628 y = 6779364 a = 132349 b = 2701 y = 7163052 a = 137825 b = 2775 y = 7562800 a = 143450 b = 2850 y = 7979050 a = 149226 b = 2926 y = 8412250 a = 155155 b = 3003 y = 8862854 a = 161239 b = 3081 y = 9331322 a = 167480 b = 3160 y = 9818120 a = 173880 b = 3240 y = 10323720 a = 180441 b = 3321 y = 10848600 a = 187165 b = 3403 y = 11393244 a = 194054 b = 3486 y = 11958142 a = 201110 b = 3570 y = 12543790 a = 208335 b = 3655 y = 13150690 a = 215731 b = 3741 y = 13779350 a = 223300 b = 3828 y = 14430284 a = 231044 b = 3916 y = 15104012 a = 238965 b = 4005 y = 15801060 a = 247065 b = 4095 y = 16521960 a = 255346 b = 4186 y = 17267250 a = 263810 b = 4278 y = 18037474 a = 272459 b = 4371 y = 18833182 a = 281295 b = 4465 y = 19654930 a = 290320 b = 4560 y = 20503280 a = 299536 b = 4656 y = 21378800 a = 308945 b = 4753 y = 22282064 a = 318549 b = 4851 y = 23213652 a = 328350 b = 4950 y = 24174150 a = 338350 b = 5050 y = 25164150 a = 348551 b = 5151 y = 26184250 a = 358955 b = 5253 y = 27235054 a = 369564 b = 5356 y = 28317172 a = 380380 b = 5460 y = 29431220 a = 391405 b = 5565 y = 30577820 a = 402641 b = 5671 y = 31757600 a = 414090 b = 5778 y = 32971194 a = 425754 b = 5886 y = 34219242 a = 437635 b = 5995 y = 35502390 a = 449735 b = 6105 y = 36821290 a = 462056 b = 6216 y = 38176600 a = 474600 b = 6328 y = 39568984 a = 487369 b = 6441 y = 40999112 a = 500365 b = 6555 y = 42467660 a = 513590 b = 6670 y = 43975310 a = 527046 b = 6786 y = 45522750 a = 540735 b = 6903 y = 47110674 a = 554659 b = 7021 y = 48739782 a = 568820 b = 7140 y = 50410780 a = 583220 b = 7260 y = 52124380 a = 597861 b = 7381 y = 53881300 a = 612745 b = 7503 y = 55682264 a = 627874 b = 7626 y = 57528002 a = 643250 b = 7750 y = 59419250 a = 658875 b = 7875 y = 61356750 a = 674751 b = 8001 y = 63341250 a = 690880 b = 8128 y = 65373504 a = 707264 b = 8256 y = 67454272 a = 723905 b = 8385 y = 69584320 a = 740805 b = 8515 y = 71764420 a = 757966 b = 8646 y = 73995350 a = 775390 b = 8778 y = 76277894 a = 793079 b = 8911 y = 78612842 a = 811035 b = 9045 y = 81000990 a = 829260 b = 9180 y = 83443140 a = 847756 b = 9316 y = 85940100 a = 866525 b = 9453 y = 88492684 a = 885569 b = 9591 y = 91101712 a = 904890 b = 9730 y = 93768010 a = 924490 b = 9870 y = 96492410 a = 944371 b = 10011 y = 99275750 a = 964535 b = 10153 y = 102118874 a = 984984 b = 10296 y = 105022632 a = 1005720 b = 10440 y = 107987880 a = 1026745 b = 10585 y = 111015480 a = 1048061 b = 10731 y = 114106300 a = 1069670 b = 10878 y = 117261214 a = 1091574 b = 11026 y = 120481102 a = 1113775 b = 11175 y = 123766850 a = 1136275 b = 11325 y = 127119350 a = 1159076 b = 11476 y = 130539500 a = 1182180 b = 11628 y = 134028204 a = 1205589 b = 11781 y = 137586372 a = 1229305 b = 11935 y = 141214920 a = 1253330 b = 12090 y = 144914770 a = 1277666 b = 12246 y = 148686850 a = 1302315 b = 12403 y = 152532094 a = 1327279 b = 12561 y = 156451442 a = 1352560 b = 12720 y = 160445840 a = 1378160 b = 12880 y = 164516240 a = 1404081 b = 13041 y = 168663600 a = 1430325 b = 13203 y = 172888884 a = 1456894 b = 13366 y = 177193062 a = 1483790 b = 13530 y = 181577110 a = 1511015 b = 13695 y = 186042010 a = 1538571 b = 13861 y = 190588750 a = 1566460 b = 14028 y = 195218324 a = 1594684 b = 14196 y = 199931732 a = 1623245 b = 14365 y = 204729980 a = 1652145 b = 14535 y = 209614080 a = 1681386 b = 14706 y = 214585050 a = 1710970 b = 14878 y = 219643914 a = 1740899 b = 1505...

### Community Treasure Hunt

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

Start Hunting!