Cody

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

Solution 1677639

Submitted on 21 Nov 2018 by Huajie Zheng
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))

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

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

c = Columns 1 through 14 3 5 6 9 10 12 15 18 20 21 24 25 27 30 Columns 15 through 28 33 35 36 39 40 42 45 48 50 51 54 55 57 60 Columns 29 through 42 63 65 66 69 70 72 75 78 80 81 84 85 87 90 Columns 43 through 56 93 95 96 99 100 102 105 108 110 111 114 115 117 120 Columns 57 through 70 123 125 126 129 130 132 135 138 140 141 144 145 147 150 Columns 71 through 84 153 155 156 159 160 162 165 168 170 171 174 175 177 180 Columns 85 through 98 183 185 186 189 190 192 195 198 200 201 204 205 207 210 Columns 99 through 112 213 215 216 219 220 222 225 228 230 231 234 235 237 240 Columns 113 through 126 243 245 246 249 250 252 255 258 260 261 264 265 267 270 Columns 127 through 140 273 275 276 279 280 282 285 288 290 291 294 295 297 300 Columns 141 through 154 303 305 306 309 310 312 315 318 320 321 324 325 327 330 Columns 155 through 168 333 335 336 339 340 342 345 348 350 351 354 355 357 360 Columns 169 through 182 363 365 366 369 370 372 375 378 380 381 384 385 387 390 Columns 183 through 196 393 395 396 399 400 402 405 408 410 411 414 415 417 420 Columns 197 through 210 423 425 426 429 430 432 435 438 440 441 444 445 447 450 Columns 211 through 224 453 455 456 459 460 462 465 468 470 471 474 475 477 480 Columns 225 through 238 483 485 486 489 490 492 495 498 500 501 504 505 507 510 Columns 239 through 252 513 515 516 519 520 522 525 528 530 531 534 535 537 540 Columns 253 through 266 543 545 546 549 550 552 555 558 560 561 564 565 567 570 Columns 267 through 280 573 575 576 579 580 582 585 588 590 591 594 595 597 600 Columns 281 through 294 603 605 606 609 610 612 615 618 620 621 624 625 627 630 Columns 295 through 308 633 635 636 639 640 642 645 648 650 651 654 655 657 660 Columns 309 through 322 663 665 666 669 670 672 675 678 680 681 684 685 687 690 Columns 323 through 336 693 695 696 699 700 702 705 708 710 711 714 715 717 720 Columns 337 through 350 723 725 726 729 730 732 735 738 740 741 744 745 747 750 Columns 351 through 364 753 755 756 759 760 762 765 768 770 771 774 775 777 780 Columns 365 through 378 783 785 786 789 790 792 795 798 800 801 804 805 807 810 Columns 379 through 392 813 815 816 819 820 822 825 828 830 831 834 835 837 840 Columns 393 through 406 843 845 846 849 850 852 855 858 860 861 864 865 867 870 Columns 407 through 420 873 875 876 879 880 882 885 888 890 891 894 895 897 900 Columns 421 through 434 903 905 906 909 910 912 915 918 920 921 924 925 927 930 Columns 435 through 448 933 935 936 939 940 942 945 948 950 951 954 955 957 960 Columns 449 through 462 963 965 966 969 970 972 975 978 980 981 984 985 987 990 Columns 463 through 476 993 995 996 999 1000 1002 1005 1008 1010 1011 1014 1015 1017 1020 Columns 477 through 490 1023 1025 1026 1029 1030 1032 1035 1038 1040 1041 1044 1045 1047 1050 Columns 491 through 504 1053 1055 1056 1059 1060 1062 1065 1068 1070 1071 1074 1075 1077 1080 Columns 505 through 518 1083 1085 1086 1089 1090 1092 1095 1098 1100 1101 1104 1105 1107 1110 Columns 519 through 532 1113 1115 1116 1119 1120 1122 1125 1128 1130 1131 1134 1135 1137 1140 Columns 533 through 546 1143 1145 1146 1149 1150 1152 1155 1158 1160 1161 1164 1165 1167 1170 Columns 547 through 560 1173 1175 1176 1179 1180 1182 1185 1188 1190 1191 1194 1195 1197 1200 Columns 561 through 574 1203 1205 1206 1209 1210 1212 1215 1218 1220 1221 1224 1225 1227 1230 Columns 575 through 588 1233 1235 1236 1239 1240 1242 1245 1248 1250 1251 1254 1255 1257 1260 Columns 589 through 602 1263 1265 1266 1269 1270 1272 1275 1278 1280 1281 1284 1285 1287 1290 Columns 603 through 616 1293 1295 1296 1299 1300 1302 1305 1308 1310 1311 1314 1315 1317 1320 Columns 617 through 630 1323 1325 1326 1329 1330 1332 1335 1338 1340 1341 1344 1345 1347 1350 Columns 631 through 644 1353 1355 1356 1359 1360 1362 1365 1368 1370 1371 1374 1375 1377 1380 Columns 645 through 658 1383 1385 1386 1389 1390 1392 1395 1398 1400 1401 1404 1405 1407 1410 Columns 659 through 672 1413 1415 1416 1419 1420 1422 1425 1428 1430 1431 1434 1435 1437 1440 Columns 673 through 686 1443 1445 1446 1449 1450 1452 1455 1458 1460 1461 1464 1465 1467 1470 Columns 687 through 700 1473 1475 1476 1479 1480 1482 1485 1488 1490 1491 1494 1495 1497 1500 Columns 701 through 714 1503 1505 1506 1509 1510 1512 1515 1518 1520 1521 1524 ...

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

c = Columns 1 through 14 3 5 6 9 10 12 15 18 20 21 24 25 27 30 Columns 15 through 28 33 35 36 39 40 42 45 48 50 51 54 55 57 60 Columns 29 through 42 63 65 66 69 70 72 75 78 80 81 84 85 87 90 Columns 43 through 56 93 95 96 99 100 102 105 108 110 111 114 115 117 120 Columns 57 through 70 123 125 126 129 130 132 135 138 140 141 144 145 147 150 Columns 71 through 84 153 155 156 159 160 162 165 168 170 171 174 175 177 180 Columns 85 through 98 183 185 186 189 190 192 195 198 200 201 204 205 207 210 Columns 99 through 112 213 215 216 219 220 222 225 228 230 231 234 235 237 240 Columns 113 through 126 243 245 246 249 250 252 255 258 260 261 264 265 267 270 Columns 127 through 140 273 275 276 279 280 282 285 288 290 291 294 295 297 300 Columns 141 through 154 303 305 306 309 310 312 315 318 320 321 324 325 327 330 Columns 155 through 168 333 335 336 339 340 342 345 348 350 351 354 355 357 360 Columns 169 through 182 363 365 366 369 370 372 375 378 380 381 384 385 387 390 Columns 183 through 196 393 395 396 399 400 402 405 408 410 411 414 415 417 420 Columns 197 through 210 423 425 426 429 430 432 435 438 440 441 444 445 447 450 Columns 211 through 224 453 455 456 459 460 462 465 468 470 471 474 475 477 480 Columns 225 through 238 483 485 486 489 490 492 495 498 500 501 504 505 507 510 Columns 239 through 252 513 515 516 519 520 522 525 528 530 531 534 535 537 540 Columns 253 through 266 543 545 546 549 550 552 555 558 560 561 564 565 567 570 Columns 267 through 280 573 575 576 579 580 582 585 588 590 591 594 595 597 600 Columns 281 through 294 603 605 606 609 610 612 615 618 620 621 624 625 627 630 Columns 295 through 308 633 635 636 639 640 642 645 648 650 651 654 655 657 660 Columns 309 through 322 663 665 666 669 670 672 675 678 680 681 684 685 687 690 Columns 323 through 336 693 695 696 699 700 702 705 708 710 711 714 715 717 720 Columns 337 through 350 723 725 726 729 730 732 735 738 740 741 744 745 747 750 Columns 351 through 364 753 755 756 759 760 762 765 768 770 771 774 775 777 780 Columns 365 through 378 783 785 786 789 790 792 795 798 800 801 804 805 807 810 Columns 379 through 392 813 815 816 819 820 822 825 828 830 831 834 835 837 840 Columns 393 through 406 843 845 846 849 850 852 855 858 860 861 864 865 867 870 Columns 407 through 420 873 875 876 879 880 882 885 888 890 891 894 895 897 900 Columns 421 through 434 903 905 906 909 910 912 915 918 920 921 924 925 927 930 Columns 435 through 448 933 935 936 939 940 942 945 948 950 951 954 955 957 960 Columns 449 through 462 963 965 966 969 970 972 975 978 980 981 984 985 987 990 Columns 463 through 476 993 995 996 999 1000 1002 1005 1008 1010 1011 1014 1015 1017 1020 Columns 477 through 490 1023 1025 1026 1029 1030 1032 1035 1038 1040 1041 1044 1045 1047 1050 Columns 491 through 504 1053 1055 1056 1059 1060 1062 1065 1068 1070 1071 1074 1075 1077 1080 Columns 505 through 518 1083 1085 1086 1089 1090 1092 1095 1098 1100 1101 1104 1105 1107 1110 Columns 519 through 532 1113 1115 1116 1119 1120 1122 1125 1128 1130 1131 1134 1135 1137 1140 Columns 533 through 546 1143 1145 1146 1149 1150 1152 1155 1158 1160 1161 1164 1165 1167 1170 Columns 547 through 560 1173 1175 1176 1179 1180 1182 1185 1188 1190 1191 1194 1195 1197 1200 Columns 561 through 574 1203 1205 1206 1209 1210 1212 1215 1218 1220 1221 1224 1225 1227 1230 Columns 575 through 588 1233 1235 1236 1239 1240 1242 1245 1248 1250 1251 1254 1255 1257 1260 Columns 589 through 602 1263 1265 1266 1269 1270 1272 1275 1278 1280 1281 1284 1285 1287 1290 Columns 603 through 616 1293 1295 1296 1299 1300 1302 1305 1308 1310 1311 1314 1315 1317 1320 Columns 617 through 630 1323 1325 1326 1329 1330 1332 1335 1338 1340 1341 1344 1345 1347 1350 Columns 631 through 644 1353 1355 1356 1359 1360 1362 1365 1368 1370 1371 1374 1375 1377 1380 Columns 645 through 658 1383 1385 1386 1389 1390 1392 1395 1398 1400 1401 1404 1405 1407 1410 Columns 659 through 672 1413 1415 1416 1419 1420 1422 1425 1428 1430 1431 1434 1435 1437 1440 Columns 673 through 686 1443 1445 1446 1449 1450 1452 1455 1458 1460 1461 1464 1465 1467 1470 Columns 687 through 700 1473 1475 1476 1479 1480 1482 1485 1488 1490 1491 1494 1495 1497 1500 Columns 701 through 714 1503 1505 1506 1509 1510 1512 1515 1518 1520 1521 1524 ...

4   Pass
x = 2341; y_correct = 1278810; assert(isequal(euler001(x),y_correct))

c = Columns 1 through 14 3 5 6 9 10 12 15 18 20 21 24 25 27 30 Columns 15 through 28 33 35 36 39 40 42 45 48 50 51 54 55 57 60 Columns 29 through 42 63 65 66 69 70 72 75 78 80 81 84 85 87 90 Columns 43 through 56 93 95 96 99 100 102 105 108 110 111 114 115 117 120 Columns 57 through 70 123 125 126 129 130 132 135 138 140 141 144 145 147 150 Columns 71 through 84 153 155 156 159 160 162 165 168 170 171 174 175 177 180 Columns 85 through 98 183 185 186 189 190 192 195 198 200 201 204 205 207 210 Columns 99 through 112 213 215 216 219 220 222 225 228 230 231 234 235 237 240 Columns 113 through 126 243 245 246 249 250 252 255 258 260 261 264 265 267 270 Columns 127 through 140 273 275 276 279 280 282 285 288 290 291 294 295 297 300 Columns 141 through 154 303 305 306 309 310 312 315 318 320 321 324 325 327 330 Columns 155 through 168 333 335 336 339 340 342 345 348 350 351 354 355 357 360 Columns 169 through 182 363 365 366 369 370 372 375 378 380 381 384 385 387 390 Columns 183 through 196 393 395 396 399 400 402 405 408 410 411 414 415 417 420 Columns 197 through 210 423 425 426 429 430 432 435 438 440 441 444 445 447 450 Columns 211 through 224 453 455 456 459 460 462 465 468 470 471 474 475 477 480 Columns 225 through 238 483 485 486 489 490 492 495 498 500 501 504 505 507 510 Columns 239 through 252 513 515 516 519 520 522 525 528 530 531 534 535 537 540 Columns 253 through 266 543 545 546 549 550 552 555 558 560 561 564 565 567 570 Columns 267 through 280 573 575 576 579 580 582 585 588 590 591 594 595 597 600 Columns 281 through 294 603 605 606 609 610 612 615 618 620 621 624 625 627 630 Columns 295 through 308 633 635 636 639 640 642 645 648 650 651 654 655 657 660 Columns 309 through 322 663 665 666 669 670 672 675 678 680 681 684 685 687 690 Columns 323 through 336 693 695 696 699 700 702 705 708 710 711 714 715 717 720 Columns 337 through 350 723 725 726 729 730 732 735 738 740 741 744 745 747 750 Columns 351 through 364 753 755 756 759 760 762 765 768 770 771 774 775 777 780 Columns 365 through 378 783 785 786 789 790 792 795 798 800 801 804 805 807 810 Columns 379 through 392 813 815 816 819 820 822 825 828 830 831 834 835 837 840 Columns 393 through 406 843 845 846 849 850 852 855 858 860 861 864 865 867 870 Columns 407 through 420 873 875 876 879 880 882 885 888 890 891 894 895 897 900 Columns 421 through 434 903 905 906 909 910 912 915 918 920 921 924 925 927 930 Columns 435 through 448 933 935 936 939 940 942 945 948 950 951 954 955 957 960 Columns 449 through 462 963 965 966 969 970 972 975 978 980 981 984 985 987 990 Columns 463 through 476 993 995 996 999 1000 1002 1005 1008 1010 1011 1014 1015 1017 1020 Columns 477 through 490 1023 1025 1026 1029 1030 1032 1035 1038 1040 1041 1044 1045 1047 1050 Columns 491 through 504 1053 1055 1056 1059 1060 1062 1065 1068 1070 1071 1074 1075 1077 1080 Columns 505 through 518 1083 1085 1086 1089 1090 1092 1095 1098 1100 1101 1104 1105 1107 1110 Columns 519 through 532 1113 1115 1116 1119 1120 1122 1125 1128 1130 1131 1134 1135 1137 1140 Columns 533 through 546 1143 1145 1146 1149 1150 1152 1155 1158 1160 1161 1164 1165 1167 1170 Columns 547 through 560 1173 1175 1176 1179 1180 1182 1185 1188 1190 1191 1194 1195 1197 1200 Columns 561 through 574 1203 1205 1206 1209 1210 1212 1215 1218 1220 1221 1224 1225 1227 1230 Columns 575 through 588 1233 1235 1236 1239 1240 1242 1245 1248 1250 1251 1254 1255 1257 1260 Columns 589 through 602 1263 1265 1266 1269 1270 1272 1275 1278 1280 1281 1284 1285 1287 1290 Columns 603 through 616 1293 1295 1296 1299 1300 1302 1305 1308 1310 1311 1314 1315 1317 1320 Columns 617 through 630 1323 1325 1326 1329 1330 1332 1335 1338 1340 1341 1344 1345 1347 1350 Columns 631 through 644 1353 1355 1356 1359 1360 1362 1365 1368 1370 1371 1374 1375 1377 1380 Columns 645 through 658 1383 1385 1386 1389 1390 1392 1395 1398 1400 1401 1404 1405 1407 1410 Columns 659 through 672 1413 1415 1416 1419 1420 1422 1425 1428 1430 1431 1434 1435 1437 1440 Columns 673 through 686 1443 1445 1446 1449 1450 1452 1455 1458 1460 1461 1464 1465 1467 1470 Columns 687 through 700 1473 1475 1476 1479 1480 1482 1485 1488 1490 1491 1494 1495 1497 1500 Columns 701 through 714 1503 1505 1506 1509 1510 1512 1515 1518 1520 1521 1524 ...