Cody

# Problem 230. Project Euler: Problem 1, Multiples of 3 and 5

Solution 32048

Submitted on 7 Feb 2012 by David Smith
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 = 1000; y_correct = 233168; assert(isequal(euler001(x),y_correct))

a = Columns 1 through 10 3 6 9 12 15 18 21 24 27 30 Columns 11 through 20 33 36 39 42 45 48 51 54 57 60 Columns 21 through 30 63 66 69 72 75 78 81 84 87 90 Columns 31 through 40 93 96 99 102 105 108 111 114 117 120 Columns 41 through 50 123 126 129 132 135 138 141 144 147 150 Columns 51 through 60 153 156 159 162 165 168 171 174 177 180 Columns 61 through 70 183 186 189 192 195 198 201 204 207 210 Columns 71 through 80 213 216 219 222 225 228 231 234 237 240 Columns 81 through 90 243 246 249 252 255 258 261 264 267 270 Columns 91 through 100 273 276 279 282 285 288 291 294 297 300 Columns 101 through 110 303 306 309 312 315 318 321 324 327 330 Columns 111 through 120 333 336 339 342 345 348 351 354 357 360 Columns 121 through 130 363 366 369 372 375 378 381 384 387 390 Columns 131 through 140 393 396 399 402 405 408 411 414 417 420 Columns 141 through 150 423 426 429 432 435 438 441 444 447 450 Columns 151 through 160 453 456 459 462 465 468 471 474 477 480 Columns 161 through 170 483 486 489 492 495 498 501 504 507 510 Columns 171 through 180 513 516 519 522 525 528 531 534 537 540 Columns 181 through 190 543 546 549 552 555 558 561 564 567 570 Columns 191 through 200 573 576 579 582 585 588 591 594 597 600 Columns 201 through 210 603 606 609 612 615 618 621 624 627 630 Columns 211 through 220 633 636 639 642 645 648 651 654 657 660 Columns 221 through 230 663 666 669 672 675 678 681 684 687 690 Columns 231 through 240 693 696 699 702 705 708 711 714 717 720 Columns 241 through 250 723 726 729 732 735 738 741 744 747 750 Columns 251 through 260 753 756 759 762 765 768 771 774 777 780 Columns 261 through 270 783 786 789 792 795 798 801 804 807 810 Columns 271 through 280 813 816 819 822 825 828 831 834 837 840 Columns 281 through 290 843 846 849 852 855 858 861 864 867 870 Columns 291 through 300 873 876 879 882 885 888 891 894 897 900 Columns 301 through 310 903 906 909 912 915 918 921 924 927 930 Columns 311 through 320 933 936 939 942 945 948 951 954 957 960 Columns 321 through 330 963 966 969 972 975 978 981 984 987 990 Columns 331 through 333 993 996 999 b = Columns 1 through 10 5 10 15 20 25 30 35 40 45 50 Columns 11 through 20 55 60 65 70 75 80 85 90 95 100 Columns 21 through 30 105 110 115 120 125 130 135 140 145 150 Columns 31 through 40 155 160 165 170 175 180 185 190 195 200 Columns 41 through 50 205 210 215 220 225 230 235 240 245 250 Columns 51 through 60 255 260 265 270 275 280 285 290 295 300 Columns 61 through 70 305 310 315 320 325 330 335 340 345 350 Columns 71 through 80 355 360 365 370 375 380 385 390 395 400 Columns 81 through 90 405 410 415 420 425 430 435 440 445 450 Columns 91 through 100 455 460 465 470 475 480 485 490 495 500 Columns 101 through 110 505 510 515 520 525 530 535 540 545 550 Columns 111 through 120 555 560 565 570 575 580 585 590 595 600 Columns 121 through 130 605 610 615 620 625 630 635 640 645 650 Columns 131 through 140 655 660 665 670 675 680 685 690 695 700 Columns 141 through 150 705 710 715 720 725 730 735 740 745 750 Columns 151 through 160 755 760 765 770 775 780 785 790 795 800 Columns 161 through 170 805 810 815 820 825 830 835 840 845 850 Columns 171 through 180 855 860 865 870 875 880 885 890 895 900 Columns 181 through 190 905 910 915 920 925 930 935 940 945 950 Columns 191 through 199 955 960 965 970 975 980 985 990 995 y = 233168

2   Pass
%% x = 4000; y_correct = 3732668; assert(isequal(euler001(x),y_correct))

a = Columns 1 through 5 3 6 9 12 15 Columns 6 through 10 18 21 24 27 30 Columns 11 through 15 33 36 39 42 45 Columns 16 through 20 48 51 54 57 60 Columns 21 through 25 63 66 69 72 75 Columns 26 through 30 78 81 84 87 90 Columns 31 through 35 93 96 99 102 105 Columns 36 through 40 108 111 114 117 120 Columns 41 through 45 123 126 129 132 135 Columns 46 through 50 138 141 144 147 150 Columns 51 through 55 153 156 159 162 165 Columns 56 through 60 168 171 174 177 180 Columns 61 through 65 183 186 189 192 195 Columns 66 through 70 198 201 204 207 210 Columns 71 through 75 213 216 219 222 225 Columns 76 through 80 228 231 234 237 240 Columns 81 through 85 243 246 249 252 255 Columns 86 through 90 258 261 264 267 270 Columns 91 through 95 273 276 279 282 285 Columns 96 through 100 288 291 294 297 300 Columns 101 through 105 303 306 309 312 315 Columns 106 through 110 318 321 324 327 330 Columns 111 through 115 333 336 339 342 345 Columns 116 through 120 348 351 354 357 360 Columns 121 through 125 363 366 369 372 375 Columns 126 through 130 378 381 384 387 390 Columns 131 through 135 393 396 399 402 405 Columns 136 through 140 408 411 414 417 420 Columns 141 through 145 423 426 429 432 435 Columns 146 through 150 438 441 444 447 450 Columns 151 through 155 453 456 459 462 465 Columns 156 through 160 468 471 474 477 480 Columns 161 through 165 483 486 489 492 495 Columns 166 through 170 498 501 504 507 510 Columns 171 through 175 513 516 519 522 525 Columns 176 through 180 528 531 534 537 540 Columns 181 through 185 543 546 549 552 555 Columns 186 through 190 558 561 564 567 570 Columns 191 through 195 573 576 579 582 585 Columns 196 through 200 588 591 594 597 600 Columns 201 through 205 603 606 609 612 615 Columns 206 through 210 618 621 624 627 630 Columns 211 through 215 633 636 639 642 645 Columns 216 through 220 648 651 654 657 660 Columns 221 through 225 663 666 669 672 675 Columns 226 through 230 678 681 684 687 690 Columns 231 through 235 693 696 699 702 705 Columns 236 through 240 708 711 714 717 720 Columns 241 through 245 723 726 729 732 735 Columns 246 through 250 738 741 744 747 750 Columns 251 through 255 753 756 759 762 765 Columns 256 through 260 768 771 774 777 780 Columns 261 through 265 783 786 789 792 795 Columns 266 through 270 798 801 804 807 810 Columns 271 through 275 813 816 819 822 825 Columns 276 through 280 828 831 834 837 840 Columns 281 through 285 843 846 849 852 855 Columns 286 through 290 858 861 864 867 870 Columns 291 through 295 873 876 879 882 885 Columns 296 through 300 888 891 894 897 900 Columns 301 through 305 903 906 909 912 915 Columns 306 through 310 918 921 924 927 930 Columns 311 through 315 933 936 939 942 945 Columns 316 through 320 948 951 954 957 960 Columns 321 through 325 963 966 969 972 975 Columns 326 through 330 978 981 984 987 990 Columns 331 through 335 993 996 999 1002 1005 Columns 336 through 340 1008 1011 1014 1017 1020 Columns 341 through 345 1023 1026 1029 1032 1035 Columns 346 through 350 1038 1041 1044 1047 1050 Columns 351 through 355 1053 1056 1059 1062 1065 Columns 356 through 360 1068 1071 1074 1077 1080 Columns 361 through 365 1083 1086 1089 1092 1095 Columns 366 through 370 1098 1101 1104 1107 1110 Columns 371 through 375 1113 1116 1119 1122 1125 Columns 376 through 380 1128 1131 1134 1137 1140 Columns 381 through 385 1143 1146 1149 1152 1155 Columns 386 through 390 1158 1161 1164 1167 1170 Columns 391 through 395 1173 1176 1179 1182 1185 Columns 396 through 400 1188 1191 1194 1197 1200 Columns 401 through 405 1203 1206 1209 1212 1215 Columns 406 through 410 1218 1221 1224 1227 1230 Columns 411 through 415 1233 1236 1239 1242 1245 Columns 416 through 420 1248 1251 1254 1257 1260 Columns 421 through 425 1263 1266 1269 1272 1275 Columns 426 through 430 1278 1281 1284 1287 1290 Columns 431 through 435 1293 1296 1299 1302 1305 Columns 436 through 440 1308 1311 1314 1317 1320 Columns 441 through 445 1323 1326 1329 1332 1335 Columns 446 through 450 1338 1341 1344 1347 1350 Columns 451 through 455 1353 1356 1359 1362 1365 Columns 456 through 460 1368 1371 1374 1377 1380 Columns 461 through 465 1383 1386 1389 1392 1395 Columns 466 through 470 1398 1401 1404 1407 1410 Columns 471 through 475 1413 1416 1419 1422 1425 Columns 476 through 480 1428 1431 1434 1437 1440 Columns 481 through 485 1443 1446 1449 1452 1455 Columns 486 through 490 1458 1461 1464 1467 1470 Columns 491 through 495 1473 1476 1479 1482 1485 Columns 496 through 500 1488 1491 1494 1497 1500 Columns 501 through 505 1503 1506 1509 1512 1515 Columns 506 through 510 1518 1521 1524 1527 1530 Columns 511 through 515 1533 1536 1539 1542 1545 Columns 516 through 520 1548 1551 1554 1557 1560 Columns 521 through 525 1563 1566 1569 1572 1575 Columns 526 through 530 1578 1581 1584 1587 1590 Columns 531 through 535 1593 1596 1599 1602 1605 Columns 536 through 540 1608 1611 1614 1617 1620 Columns 541 through 545 1623 1626 1629 1632 1635 Columns 546 through 550 1638 1641 1644 1647 1650 Columns 551 through 555 1653 1656 1659 1662 1665 Columns 556 through 560 1668 1671 1674 1677 1680 Columns 561 through 565 1683 1686 1689 1692 1695 Columns 566 through 570 1698 1701 1704 1707 1710 Columns 571 through 575 1713 1716 1719 1722 1725 Columns 576 through 580 ...

3   Pass
%% x = 2340; y_correct = 1276470; assert(isequal(euler001(x),y_correct))

a = Columns 1 through 5 3 6 9 12 15 Columns 6 through 10 18 21 24 27 30 Columns 11 through 15 33 36 39 42 45 Columns 16 through 20 48 51 54 57 60 Columns 21 through 25 63 66 69 72 75 Columns 26 through 30 78 81 84 87 90 Columns 31 through 35 93 96 99 102 105 Columns 36 through 40 108 111 114 117 120 Columns 41 through 45 123 126 129 132 135 Columns 46 through 50 138 141 144 147 150 Columns 51 through 55 153 156 159 162 165 Columns 56 through 60 168 171 174 177 180 Columns 61 through 65 183 186 189 192 195 Columns 66 through 70 198 201 204 207 210 Columns 71 through 75 213 216 219 222 225 Columns 76 through 80 228 231 234 237 240 Columns 81 through 85 243 246 249 252 255 Columns 86 through 90 258 261 264 267 270 Columns 91 through 95 273 276 279 282 285 Columns 96 through 100 288 291 294 297 300 Columns 101 through 105 303 306 309 312 315 Columns 106 through 110 318 321 324 327 330 Columns 111 through 115 333 336 339 342 345 Columns 116 through 120 348 351 354 357 360 Columns 121 through 125 363 366 369 372 375 Columns 126 through 130 378 381 384 387 390 Columns 131 through 135 393 396 399 402 405 Columns 136 through 140 408 411 414 417 420 Columns 141 through 145 423 426 429 432 435 Columns 146 through 150 438 441 444 447 450 Columns 151 through 155 453 456 459 462 465 Columns 156 through 160 468 471 474 477 480 Columns 161 through 165 483 486 489 492 495 Columns 166 through 170 498 501 504 507 510 Columns 171 through 175 513 516 519 522 525 Columns 176 through 180 528 531 534 537 540 Columns 181 through 185 543 546 549 552 555 Columns 186 through 190 558 561 564 567 570 Columns 191 through 195 573 576 579 582 585 Columns 196 through 200 588 591 594 597 600 Columns 201 through 205 603 606 609 612 615 Columns 206 through 210 618 621 624 627 630 Columns 211 through 215 633 636 639 642 645 Columns 216 through 220 648 651 654 657 660 Columns 221 through 225 663 666 669 672 675 Columns 226 through 230 678 681 684 687 690 Columns 231 through 235 693 696 699 702 705 Columns 236 through 240 708 711 714 717 720 Columns 241 through 245 723 726 729 732 735 Columns 246 through 250 738 741 744 747 750 Columns 251 through 255 753 756 759 762 765 Columns 256 through 260 768 771 774 777 780 Columns 261 through 265 783 786 789 792 795 Columns 266 through 270 798 801 804 807 810 Columns 271 through 275 813 816 819 822 825 Columns 276 through 280 828 831 834 837 840 Columns 281 through 285 843 846 849 852 855 Columns 286 through 290 858 861 864 867 870 Columns 291 through 295 873 876 879 882 885 Columns 296 through 300 888 891 894 897 900 Columns 301 through 305 903 906 909 912 915 Columns 306 through 310 918 921 924 927 930 Columns 311 through 315 933 936 939 942 945 Columns 316 through 320 948 951 954 957 960 Columns 321 through 325 963 966 969 972 975 Columns 326 through 330 978 981 984 987 990 Columns 331 through 335 993 996 999 1002 1005 Columns 336 through 340 1008 1011 1014 1017 1020 Columns 341 through 345 1023 1026 1029 1032 1035 Columns 346 through 350 1038 1041 1044 1047 1050 Columns 351 through 355 1053 1056 1059 1062 1065 Columns 356 through 360 1068 1071 1074 1077 1080 Columns 361 through 365 1083 1086 1089 1092 1095 Columns 366 through 370 1098 1101 1104 1107 1110 Columns 371 through 375 1113 1116 1119 1122 1125 Columns 376 through 380 1128 1131 1134 1137 1140 Columns 381 through 385 1143 1146 1149 1152 1155 Columns 386 through 390 1158 1161 1164 1167 1170 Columns 391 through 395 1173 1176 1179 1182 1185 Columns 396 through 400 1188 1191 1194 1197 1200 Columns 401 through 405 1203 1206 1209 1212 1215 Columns 406 through 410 1218 1221 1224 1227 1230 Columns 411 through 415 1233 1236 1239 1242 1245 Columns 416 through 420 1248 1251 1254 1257 1260 Columns 421 through 425 1263 1266 1269 1272 1275 Columns 426 through 430 1278 1281 1284 1287 1290 Columns 431 through 435 1293 1296 1299 1302 1305 Columns 436 through 440 1308 1311 1314 1317 1320 Columns 441 through 445 1323 1326 1329 1332 1335 Columns 446 through 450 1338 1341 1344 1347 1350 Columns 451 through 455 1353 1356 1359 1362 1365 Columns 456 through 460 1368 1371 1374 1377 1380 Columns 461 through 465 1383 1386 1389 1392 1395 Columns 466 through 470 1398 1401 1404 1407 1410 Columns 471 through 475 1413 1416 1419 1422 1425 Columns 476 through 480 1428 1431 1434 1437 1440 Columns 481 through 485 1443 1446 1449 1452 1455 Columns 486 through 490 1458 1461 1464 1467 1470 Columns 491 through 495 1473 1476 1479 1482 1485 Columns 496 through 500 1488 1491 1494 1497 1500 Columns 501 through 505 1503 1506 1509 1512 1515 Columns 506 through 510 1518 1521 1524 1527 1530 Columns 511 through 515 1533 1536 1539 1542 1545 Columns 516 through 520 1548 1551 1554 1557 1560 Columns 521 through 525 1563 1566 1569 1572 1575 Columns 526 through 530 1578 1581 1584 1587 1590 Columns 531 through 535 1593 1596 1599 1602 1605 Columns 536 through 540 1608 1611 1614 1617 1620 Columns 541 through 545 1623 1626 1629 1632 1635 Columns 546 through 550 1638 1641 1644 1647 1650 Columns 551 through 555 1653 1656 1659 1662 1665 Columns 556 through 560 1668 1671 1674 1677 1680 Columns 561 through 565 1683 1686 1689 1692 1695 Columns 566 through 570 1698 1701 1704 1707 1710 Columns 571 through 575 1713 1716 1719 1722 1725 Columns 576 through 580 ...

4   Fail