In the middle of 2023 i.e. between 20 and 23 enter
a number such that the new number will be a multiple of 2023.
a. What is the smallest number to fulfill the above requirement?
b. What if the number to be inserted should consist of the same digit repeated n times? Please provide a solution with lowest n.
c. In case no solution exists for (b) or it needs too much time, solve for 23, inserting a string of numbers between 2 and 3 so that the resulting number will be divisible by 23.
a.
The smallest inserted number is 43, as 204323 / 2023 = 101.
from:
for n=0:999999
ns=char(string(n));
b=str2double(['20' ns '23']);
if mod(b,2023)==0
disp(n)
end
end
finding these inserted numbers (before being cut off manually):
43
250
2320
4343
6366
8389
10882
12905
14928
16951
18974
20997
23020
25043
27066
29089
31112
33135
35158
37181
39204
41227
43250
45273
47296
49319
51342
53365
55388
57411
59434
61457
63480
65503
67526
69549
71572
73595
75618
77641
79664
81687
83710
85733
87756
89779
91802
93825
95848
97871
99894
100548
102571
104594
106617
108640
110663
112686
114709
116732
118755
b.
for r=1:1000
for dig='0':'9'
b=sym(['20' repmat(dig,1,r) '23']);
if mod(b,2023)==0
disp([r str2double(dig)])
if r<100
disp(b)
end
end
end
end
finds
(for the first two cases, the whole resulting number is shown; in other cases onlythe number of repetitions and the digit being repeated are shown)
repeated
repetitions digit
48 7
2077777777777777777777777777777777777777777777777723
96 7
2077777777777777777777777777777777777777777777777777
... 777777777777777777777777777777777777777777777723
144 7
192 7
240 7
272 2
272 9
288 7
336 7
384 7
432 7
480 7
528 7
544 2
544 9
576 7
624 7
672 7
720 7
768 7
816 0
816 1
816 2
816 3
816 4
816 5
816 6
816 7
816 8
816 9
864 7
912 7
960 7
|
Posted by Charlie
on 2023-09-20 13:00:24 |