A={the set of all positive integers leaving a remainder of 4 when divided by 45}
B={the set of all positive integers leaving a remainder of 45 when divided by 454}
C={the set of all positive integers leaving a remainder of 454 when divided by 4545}
D={the set of all positive integers leaving a remainder of 4545 when divided by 45454}
Find the smallest number in the intersection of
1)Sets A and B;
2)Sets A and B and C;
3)Sets A and B and C and D.
In UBASIC:
list
10 N=45+4
15 Incr=45
20 while 1=1
30 N=N+Incr
40 if N@454=45 then
50 :if Did=0 then print N;"B":Did=1:Incr=lcm(45,454):endif
60 :if N@4545=454 then
70 :if Did2=0 then print N;"BC":Did2=1:Incr=lcm(45,454,4545):endif
80 :if N@45454=4545 then
90 :print N;"BCD":end
100 :endif:endif
110 wend
OK
run
499 B
41359 BC
35641667749 BCD
OK
|
Posted by Charlie
on 2006-04-15 18:39:50 |