The numbers 637, 638, and 639 constitute a set of three consecutive positive integers (in order) that are respectively divisible by 13, 11, and 9.
Find the first set of four consecutive positive integers (in order) that are respectively divisible by 13, 11, 9, and 7.
How about the first set of five consecutive positive integers (in order) that are respectively divisible by 13, 11, 9, 7, and 5?
The first line below creates a vector containing all the integers below 1 million that are 1 larger than a multiple of 13.
The second line produces one that contains 1 larger than each of those in the first vector that are multiples of 11.
The third line produces one that contains 1 larger than each of those in the second vector that are multiples of 9.
The fourth line produces one that contains 1 larger than each of those in the third vector that are multiples of 7.
The fifth line produces one that contains 1 larger than each of those in the fourth vector that are multiples of 5.
The sixth line produces one that contains 1 larger than each of those in the fifth vector that are multiples of 3.
thPlus1=1:13:1000000;
elevPlus1=thPlus1(mod(thPlus1,11)==0)+1;
ninePlus1=elevPlus1(mod(elevPlus1,9)==0)+1;
sevPlus1=ninePlus1(mod(ninePlus1,7)==0)+1;
fivePlus1=sevPlus1(mod(sevPlus1,5)==0)+1;
threePlus1=fivePlus1(mod(fivePlus1,3)==0)+1;
clc
st=ninePlus1(1)-1;
second=st-1;
third=st-2;
disp([third,second,st])
st=sevPlus1(1)-1;
second=st-1;
third=st-2;
fourth=st-3;
disp([fourth,third,second,st])
st=fivePlus1(1)-1;
second=st-1;
third=st-2;
fourth=st-3;
fifth=st-4;
disp([fifth,fourth,third,second,st])
st=threePlus1(1)-1;
second=st-1;
third=st-2;
fourth=st-3;
fifth=st-4;
sixth=st-5;
disp([sixth,fifth,fourth,third,second,st])
finds
multiple of:
13 11 9 7 5 3
637 638 639
4498 4499 4500 4501
22516 22517 22518 22519 22520
22516 22517 22518 22519 22520 22521
The first show the given 637, 638, 639.
The second answers part 1: 4498, 4499, 4500, 4501.
The third answers part 3: 22516, 22517, 22518, 22519, 22520
The last shows that the sequence that fits part 2 continues with the next integer, which is divisible by 3.
The second set of each is
1924 1925 1926
13507 13508 13509 13510
67561 67562 67563 67564 67565
67561 67562 67563 67564 67565 67566
obtained by starting with subscript 2 in each starting case, as in
st=ninePlus1(2)-1;
|
Posted by Charlie
on 2023-02-10 10:05:51 |