Find the smallest number that, when divided successively by 15, 151, 1515 and 15151, leaves the remainders 1, 15, 151, and 1515 respectively.
The first number when that leaves 1 after division by 15 is 16.
Adding 15 until a number leaving 15 after division by 151, brings up 166.
15 and 151 are relatively prime, so we need to increase by 15*151 enought times to get a number with remainder 151 after division by 1515, and it's 4696.
The LCM of 15, 151 and 1515 is just 151*1515. Adding as many of these to get a remainder of 1515 after division by 15151 brings us to the answer: 71150611. The mechanics done by:
10 N=16
20 while N @ 151<>15:N=N+15:wend
30 print N
40 Incr=15*151
50 while N @ 1515<>151
60 N=N+Incr
70 wend
80 print N
140 Incr=151*1515
150 while N @ 15151<>1515
160 N=N+Incr
170 wend
180 print N
|
Posted by Charlie
on 2015-07-22 13:39:52 |