What are two primes p > 0 for which 1/p has a purely periodic decimal expansion with a period 5 digits long?
Source: California math competition 2001
10 point 15
20 P=2
30 while P>0
40 P=nxtprm(P)
50 S=cutspc(str(1/P))
60 if mid(S,3,5)=mid(S,8,5) then print P,S
70 wend
run
Words for fractionals 15 (Decimals for display 72)
3 0.333333333333333333333333333333333333333333333333333333333333333333333333
41 0.024390243902439024390243902439024390243902439024390243902439024390243902
271 0.0036900369003690036900369003690036900369003690036900369003690036900369
Break in 60
?p
59083543
OK
Interrupted while checking prime 59083543, the program had found 41 and 271. The 3 is an artifact of checking only that the numbers repeat every 5 digits from the decimal point without checking that the digits are different.
|
Posted by Charlie
on 2011-12-16 22:13:25 |