N is a duodecimal positive integer ≤ BB.
Find the value of N such that 1/N has the maximum period of its digits after the duodecimal point.
The longest period is 138 based on N = B7, which is 139 in decimal, based upon the following results:
138 139 11 7
0 1 0 5 2 1 10 9 5 11 5 9 4 11 0 7 3 0 3 1 3 6 5 8 4 5 10 5 4 2 9 1 9 9 0 9 3 10 7 5 1 1 5 7 4 0 8 3 5 5 3 2 3 11 7 10 3 3 4 4 10 0 2 0 10 4 3 9 6 11 10 11 6 9 10 1 2 6 0 6 2 7 0 11 4 8 11 8 10 8 5 6 3 7 6 1 6 7 9 2 10 2 2 11 2 8 1 4 6 10 10 6 4 7 11 3 8 6 6 8 9 8 0 4 1 8 8 7 7 1 11 9 11 1 7 8 2 5
0 1 0 5 2 1 10 9 5 11 5 9 4 11 0 7 3 0 3 1 3 6 5 8 4 5 10 5 4 2 9 1 9 9 0 9 3 10 7 5 1 1 5 7 4 0 8 3 5 5 3 2 3 11 7 10 3 3 4 4 10 0 2 0 10 4 3 9 6 11 10 11 6 9 10 1 2 6 0 6 2 7 0 11 4 8 11 8 10 8 5 6 3 7 6 1 6 7 9 2 10 2 2 11 2 8 1 4 6 10 10 6 4 7 11 3 8 6 6 8 9 8 0 4 1 8 8 7 7 1 11 9 11 1 7 8 2 5
The decimal representation of the first 276 duodecimal digits is shown, with a blank line between the repetitions of the 138 digits.
5 point 255
6 kill "recipper.txt":open "recipper.txt" for output as #2
10 for P1=0 to 11
20 for P2=0 to 11
30 N=12*P1+P2:n0=n
40 Ct=1:numrtr=11
50 if n>0 and n@2>0 and n@3>0 then
60 :while numrtr @ n >0
70 :inc ct
80 :numrtr=12*numrtr+11
85 :wend
90 :if ct>mx then mx=ct:mxn=n:mxp1=p1:mxp2=p2
100 next
110 next
120 print mx,mxn,mxp1,mxp2
121 print #2, mx,mxn,mxp1,mxp2
130 f=1/mxn
140 for i=1 to 2*mx
150 f=f*12
159 print int(f);" ";
160 print #2, int(f);" ";
161 if i=mx then print:print
162 if i=mx then print #2,:print #2,
165 f=f-int(f)
170 next
180 print: print #2,
190 close #2
|
Posted by Charlie
on 2016-10-29 10:49:24 |