Cody

# Problem 1066. Multiples of a Number in a Given Range

Solution 2026303

Submitted on 18 Nov 2019 by Le Duc Vu
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
assert(isequal(bounded_multiples(66,119,163),132))

multiples = [] i = 2 j = 2 multiples = 132

2   Pass
assert(isequal(bounded_multiples(50,341,960),[350 400 450 500 550 600 650 700 750 800 850 900 950]))

multiples = [] i = 7 j = 19 multiples = 350 multiples = 350 400 multiples = 350 400 450 multiples = 350 400 450 500 multiples = 350 400 450 500 550 multiples = 350 400 450 500 550 600 multiples = 350 400 450 500 550 600 650 multiples = 350 400 450 500 550 600 650 700 multiples = 350 400 450 500 550 600 650 700 750 multiples = 350 400 450 500 550 600 650 700 750 800 multiples = 350 400 450 500 550 600 650 700 750 800 850 multiples = 350 400 450 500 550 600 650 700 750 800 850 900 multiples = 350 400 450 500 550 600 650 700 750 800 850 900 950

3   Pass
assert(isequal(bounded_multiples(59,224,752),[236 295 354 413 472 531 590 649 708]))

multiples = [] i = 4 j = 12 multiples = 236 multiples = 236 295 multiples = 236 295 354 multiples = 236 295 354 413 multiples = 236 295 354 413 472 multiples = 236 295 354 413 472 531 multiples = 236 295 354 413 472 531 590 multiples = 236 295 354 413 472 531 590 649 multiples = 236 295 354 413 472 531 590 649 708

4   Pass
assert(isequal(bounded_multiples(26,506,700),[520 546 572 598 624 650 676]))

multiples = [] i = 20 j = 26 multiples = 520 multiples = 520 546 multiples = 520 546 572 multiples = 520 546 572 598 multiples = 520 546 572 598 624 multiples = 520 546 572 598 624 650 multiples = 520 546 572 598 624 650 676

5   Pass
assert(isequal(bounded_multiples(90,548,960),[630 720 810 900]))

multiples = [] i = 7 j = 10 multiples = 630 multiples = 630 720 multiples = 630 720 810 multiples = 630 720 810 900

6   Pass
assert(isequal(bounded_multiples(14,150,258),[154 168 182 196 210 224 238 252]))

multiples = [] i = 11 j = 18 multiples = 154 multiples = 154 168 multiples = 154 168 182 multiples = 154 168 182 196 multiples = 154 168 182 196 210 multiples = 154 168 182 196 210 224 multiples = 154 168 182 196 210 224 238 multiples = 154 168 182 196 210 224 238 252

7   Pass
assert(isequal(bounded_multiples(85,255,815),[255 340 425 510 595 680 765]))

multiples = [] i = 3 j = 9 multiples = 255 multiples = 255 340 multiples = 255 340 425 multiples = 255 340 425 510 multiples = 255 340 425 510 595 multiples = 255 340 425 510 595 680 multiples = 255 340 425 510 595 680 765

8   Pass
assert(isequal(bounded_multiples(25,350,930),[350 375 400 425 450 475 500 525 550 575 600 625 650 675 700 725 750 775 800 825 850 875 900 925]))

multiples = [] i = 14 j = 37 multiples = 350 multiples = 350 375 multiples = 350 375 400 multiples = 350 375 400 425 multiples = 350 375 400 425 450 multiples = 350 375 400 425 450 475 multiples = 350 375 400 425 450 475 500 multiples = 350 375 400 425 450 475 500 525 multiples = 350 375 400 425 450 475 500 525 550 multiples = 350 375 400 425 450 475 500 525 550 575 multiples = 350 375 400 425 450 475 500 525 550 575 600 multiples = 350 375 400 425 450 475 500 525 550 575 600 625 multiples = 350 375 400 425 450 475 500 525 550 575 600 625 650 multiples = 350 375 400 425 450 475 500 525 550 575 600 625 650 675 multiples = 350 375 400 425 450 475 500 525 550 575 600 625 650 675 700 multiples = 350 375 400 425 450 475 500 525 550 575 600 625 650 675 700 725 multiples = 350 375 400 425 450 475 500 525 550 575 600 625 650 675 700 725 750 multiples = 350 375 400 425 450 475 500 525 550 575 600 625 650 675 700 725 750 775 multiples = 350 375 400 425 450 475 500 525 550 575 600 625 650 675 700 725 750 775 800 multiples = 350 375 400 425 450 475 500 525 550 575 600 625 650 675 700 725 750 775 800 825 multiples = 350 375 400 425 450 475 500 525 550 575 600 625 650 675 700 725 750 775 800 825 850 multiples = 350 375 400 425 450 475 500 525 550 575 600 625 650 675 700 725 750 775 800 825 850 875 multiples = 350 375 400 425 450 475 500 525 550 575 600 625 650 675 700 725 750 775 800 825 850 875 900 multiples = 350 375 400 425 450 475 500 525 550 575 600 625 650 675 700 725 750 775 800 825 850 875 900 925

9   Pass
assert(isequal(bounded_multiples(20,252,617),[260 280 300 320 340 360 380 400 420 440 460 480 500 520 540 560 580 600]))

multiples = [] i = 13 j = 30 multiples = 260 multiples = 260 280 multiples = 260 280 300 multiples = 260 280 300 320 multiples = 260 280 300 320 340 multiples = 260 280 300 320 340 360 multiples = 260 280 300 320 340 360 380 multiples = 260 280 300 320 340 360 380 400 multiples = 260 280 300 320 340 360 380 400 420 multiples = 260 280 300 320 340 360 380 400 420 440 multiples = 260 280 300 320 340 360 380 400 420 440 460 multiples = 260 280 300 320 340 360 380 400 420 440 460 480 multiples = 260 280 300 320 340 360 380 400 420 440 460 480 500 multiples = 260 280 300 320 340 360 380 400 420 440 460 480 500 520 multiples = 260 280 300 320 340 360 380 400 420 440 460 480 500 520 540 multiples = 260 280 300 320 340 360 380 400 420 440 460 480 500 520 540 560 multiples = 260 280 300 320 340 360 380 400 420 440 460 480 500 520 540 560 580 multiples = 260 280 300 320 340 360 380 400 420 440 460 480 500 520 540 560 580 600

10   Pass
assert(isequal(bounded_multiples(48,352,831),[384 432 480 528 576 624 672 720 768 816]))

multiples = [] i = 8 j = 17 multiples = 384 multiples = 384 432 multiples = 384 432 480 multiples = 384 432 480 528 multiples = 384 432 480 528 576 multiples = 384 432 480 528 576 624 multiples = 384 432 480 528 576 624 672 multiples = 384 432 480 528 576 624 672 720 multiples = 384 432 480 528 576 624 672 720 768 multiples = 384 432 480 528 576 624 672 720 768 816

11   Pass
assert(isequal(bounded_multiples(59,550,918),[590 649 708 767 826 885]))

multiples = [] i = 10 j = 15 multiples = 590 multiples = 590 649 multiples = 590 649 708 multiples = 590 649 708 767 multiples = 590 649 708 767 826 multiples = 590 649 708 767 826 885

12   Pass
assert(isequal(bounded_multiples(29,754,758),754))

multiples = [] i = 26 j = 26 multiples = 754

13   Pass
assert(isequal(bounded_multiples(39,76,568),[78 117 156 195 234 273 312 351 390 429 468 507 546]))

multiples = [] i = 2 j = 14 multiples = 78 multiples = 78 117 multiples = 78 117 156 multiples = 78 117 156 195 multiples = 78 117 156 195 234 multiples = 78 117 156 195 234 273 multiples = 78 117 156 195 234 273 312 multiples = 78 117 156 195 234 273 312 351 multiples = 78 117 156 195 234 273 312 351 390 multiples = 78 117 156 195 234 273 312 351 390 429 multiples = 78 117 156 195 234 273 312 351 390 429 468 multiples = 78 117 156 195 234 273 312 351 390 429 468 507 multiples = 78 117 156 195 234 273 312 351 390 429 468 507 546

14   Pass
assert(isequal(bounded_multiples(6,531,780),[534 540 546 552 558 564 570 576 582 588 594 600 606 612 618 624 630 636 642 648 654 660 666 672 678 684 690 696 702 708 714 720 726 732 738 744 750 756 762 768 774 780]))

multiples = [] i = 89 j = 130 multiples = 534 multiples = 534 540 multiples = 534 540 546 multiples = 534 540 546 552 multiples = 534 540 546 552 558 multiples = 534 540 546 552 558 564 multiples = 534 540 546 552 558 564 570 multiples = 534 540 546 552 558 564 570 576 multiples = 534 540 546 552 558 564 570 576 582 multiples = 534 540 546 552 558 564 570 576 582 588 multiples = 534 540 546 552 558 564 570 576 582 588 594 multiples = 534 540 546 552 558 564 570 576 582 588 594 600 multiples = 534 540 546 552 558 564 570 576 582 588 594 600 606 multiples = 534 540 546 552 558 564 570 576 582 588 594 600 606 612 multiples = 534 540 546 552 558 564 570 576 582 588 594 600 606 612 618 multiples = 534 540 546 552 558 564 570 576 582 588 594 600 606 612 618 624 multiples = 534 540 546 552 558 564 570 576 582 588 594 600 606 612 618 624 630 multiples = 534 540 546 552 558 564 570 576 582 588 594 600 606 612 618 624 630 636 multiples = 534 540 546 552 558 564 570 576 582 588 594 600 606 612 618 624 630 636 642 multiples = 534 540 546 552 558 564 570 576 582 588 594 600 606 612 618 624 630 636 642 648 multiples = 534 540 546 552 558 564 570 576 582 588 594 600 606 612 618 624 630 636 642 648 654 multiples = 534 540 546 552 558 564 570 576 582 588 594 600 606 612 618 624 630 636 642 648 654 660 multiples = 534 540 546 552 558 564 570 576 582 588 594 600 606 612 618 624 630 636 642 648 654 660 666 multiples = 534 540 546 552 558 564 570 576 582 588 594 600 606 612 618 624 630 636 642 648 654 660 666 672 multiples = 534 540 546 552 558 564 570 576 582 588 594 600 606 612 618 624 630 636 642 648 654 660 666 672 678 multiples = 534 540 546 552 558 564 570 576 582 588 594 600 606 612 618 624 630 636 642 648 654 660 666 672 678 684 multiples = 534 540 546 552 558 564 570 576 582 588 594 600 606 612 618 624 630 636 642 648 654 660 666 672 678 684 690 multiples = 534 540 546 552 558 564 570 576 582 588 594 600 606 612 618 624 630 636 642 648 654 660 666 672 678 684 690 696 multiples = 534 540 546 552 558 564 570 576 582 588 594 600 606 612 618 624 630 636 642 648 654 660 666 672 678 684 690 696 702 multiples = 534 540 546 552 558 564 570 576 582 588 594 600 606 612 618 624 630 636 642 648 654 660 666 672 678 684 690 696 702 708 multiples = Columns 1 through 30 534 540 546 552 558 564 570 576 582 588 594 600 606 612 618 624 630 636 642 648 654 660 666 672 678 684 690 696 702 708 Column 31 714 multiples = Columns 1 through 30 534 540 546 552 558 564 570 576 582 588 594 600 606 612 618 624 630 636 642 648 654 660 666 672 678 684 690 696 702 708 Columns 31 through 32 714 720 multiples = Columns 1 through 30 534 540 546 552 558 564 570 576 582 588 594 600 606 612 618 624 630 636 642 648 654 660 666 672 678 684 690 696 702 708 Columns 31 through 33 714 720 726 multiples = Columns 1 through 30 534 540 546 552 558 564 570 576 582 588 594 600 606 612 618 624 630 636 642 648 654 660 666 672 678 684 690 696 702 708 Columns 31 through 34 714 720 726 732 multiples = Columns 1 through 30 534 540 546 552 558 564 570 576 582 588 594 600 606 612 618 624 630 636 642 648 654 660 666 672 678 684 690 696 702 708 Columns 31 through 35 714 720 726 732 738 multiples = Columns 1 through 30 534 540 546 552 558 564 570 576 582 588 594 600 606 612 618 624 630 636 642 648 654 660 666 672 678 684 690 696 702 708 Columns 31 through 36 714 720 726 732 738 744 multiples = Columns 1 through 30 534 540 546 552 558 564 570 576 582 588 594 600 606 612 618 624 630 636 642 648 654 660 666 672 678 684 690 696 702 708 Columns 31 through 37 714 720 726 732 738 744 750 multiples = Columns 1 through 30 534 540 546 552 558 564 570 576 582 588 594 600 606 612 618 624 630 636 642 648 654 660 666 672 678 684 690 696 702 708 Columns 31 through 38 714 720 726 732 738 744 750 756 multiples = Columns 1 through 30 534 540 546 552 558 564 570 576 582 588 594 600 606 612 618 624 630 636 642 648 654 660 666 672 678 684 690 696 702 708 Columns 31 through 39 714 720 726 732 738 744 750 756 762 multiples = Columns 1 through 30 534 540 546 552 558 564 570 576 582 588 594 600 606 612 618 624 630 636 642 648 654 660 666 672 678 684 690 696 702 708 Columns 31 through 40 714 720 726 732 738 744 750 756 762 768 multiples = Columns 1 through 30 534 540 546 552 558 564 570 576 582 588 594 600 606 612 618 624 630 636 642 648 654 660 666 672 678 684 690 696 702 708 Columns 31 through 41 714 720 726 732 738 744 750 756 762 768 774 multiples = Columns 1 through 30 534 540 546 552 558 564 570 576 582 588 594 600 606 612 618 624 630 636 642 648 654 660 666 672 678 684 690 696 702 708 Columns 31 through 42 714 720 726 732 738 744 750 756 762 768 774 780

15   Pass
assert(isequal(bounded_multiples(94,130,569),[188 282 376 470 564]))

multiples = [] i = 2 j = 6 multiples = 188 multiples = 188 282 multiples = 188 282 376 multiples = 188 282 376 470 multiples = 188 282 376 470 564

16   Pass
assert(isequal(bounded_multiples(47,12,338),[47 94 141 188 235 282 329]))

multiples = [] i = 1 j = 7 multiples = 47 multiples = 47 94 multiples = 47 94 141 multiples = 47 94 141 188 multiples = 47 94 141 188 235 multiples = 47 94 141 188 235 282 multiples = 47 94 141 188 235 282 329

17   Pass
assert(isequal(bounded_multiples(17,312,795),[323 340 357 374 391 408 425 442 459 476 493 510 527 544 561 578 595 612 629 646 663 680 697 714 731 748 765 782]))

multiples = [] i = 19 j = 46 multiples = 323 multiples = 323 340 multiples = 323 340 357 multiples = 323 340 357 374 multiples = 323 340 357 374 391 multiples = 323 340 357 374 391 408 multiples = 323 340 357 374 391 408 425 multiples = 323 340 357 374 391 408 425 442 multiples = 323 340 357 374 391 408 425 442 459 multiples = 323 340 357 374 391 408 425 442 459 476 multiples = 323 340 357 374 391 408 425 442 459 476 493 multiples = 323 340 357 374 391 408 425 442 459 476 493 510 multiples = 323 340 357 374 391 408 425 442 459 476 493 510 527 multiples = 323 340 357 374 391 408 425 442 459 476 493 510 527 544 multiples = 323 340 357 374 391 408 425 442 459 476 493 510 527 544 561 multiples = 323 340 357 374 391 408 425 442 459 476 493 510 527 544 561 578 multiples = 323 340 357 374 391 408 425 442 459 476 493 510 527 544 561 578 595 multiples = 323 340 357 374 391 408 425 442 459 476 493 510 527 544 561 578 595 612 multiples = 323 340 357 374 391 408 425 442 459 476 493 510 527 544 561 578 595 612 629 multiples = 323 340 357 374 391 408 425 442 459 476 493 510 527 544 561 578 595 612 629 646 multiples = 323 340 357 374 391 408 425 442 459 476 493 510 527 544 561 578 595 612 629 646 663 multiples = 323 340 357 374 391 408 425 442 459 476 493 510 527 544 561 578 595 612 629 646 663 680 multiples = 323 340 357 374 391 408 425 442 459 476 493 510 527 544 561 578 595 612 629 646 663 680 697 multiples = 323 340 357 374 391 408 425 442 459 476 493 510 527 544 561 578 595 612 629 646 663 680 697 714 multiples = 323 340 357 374 391 408 425 442 459 476 493 510 527 544 561 578 595 612 629 646 663 680 697 714 731 multiples = 323 340 357 374 391 408 425 442 459 476 493 510 527 544 561 578 595 612 629 646 663 680 697 714 731 748 multiples = 323 340 357 374 391 408 425 442 459 476 493 510 527 544 561 578 595 612 629 646 663 680 697 714 731 748 765 multiples = 323 340 357 374 391 408 425 442 459 476 493 510 527 544 561 578 595 612 629 646 663 680 697 714 731 748 765 782

18   Pass
assert(isequal(bounded_multiples(53,166,602),[212 265 318 371 424 477 530 583]))

multiples = [] i = 4 j = 11 multiples = 212 multiples = 212 265 multiples = 212 265 318 multiples = 212 265 318 371 multiples = 212 265 318 371 424 multiples = 212 265 318 371 424 477 multiples = 212 265 318 371 424 477 530 multiples = 212 265 318 371 424 477 530 583

19   Pass
assert(isequal(bounded_multiples(27,655,690),675))

multiples = [] i = 25 j = 25 multiples = 675

20   Pass
assert(isequal(bounded_multiples(75,84,451),[150 225 300 375 450]))

multiples = [] i = 2 j = 6 multiples = 150 multiples = 150 225 multiples = 150 225 300 multiples = 150 225 300 375 multiples = 150 225 300 375 450

### Community Treasure Hunt

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

Start Hunting!