All the
Tribonacci numbers are written successively without commas and spaces resulting in this infinite string:
00112471324448114927450492717053136...........
Reading left to right, what is the 2011th digit in the above string? How about the 20110th digit in the above string?
10 T1=0:T2=0:T3=1:TriCt=3
20 CurrLen=3
30 while EndPos<20111
40 Temp=T1+T2+T3
50 T1=T2:T2=T3:T3=Temp:inc TriCt
60 N$=cutspc(str(T3))
70 L=len(N$)
80 StPos=CurrLen+1:EndPos=CurrLen+L
90 CurrLen=EndPos
100 if 2011>=StPos and 2011<=EndPos then
110 :print TriCt,N$,StPos;EndPos,mid(N$,2011-StPos+1,1)
130 if 20110>=StPos and 20110<=EndPos then
140 :print TriCt,N$,StPos;EndPos,mid(N$,20110-StPos+1,1)
170 wend
finds
125 119816209721856219780831547518850 1992 2024 8
392 549435842499922176757513268436445454164615369446056872362025166822986968
4140693338638036540612328930253 20089 20191 5
meaning that the 125th Tribonacci is 119816209721856219780831547518850, occupying positions 1992 - 2024 of the string, so that an 8 is at position 2011; then the 392nd Tribonacci is 5494358424999221767575132684364454541646153694460568723620251668229869684140693338638036540612328930253, occupying positions 20089 - 20191, making a 5 occupy the 20110th position of the string.
|
Posted by Charlie
on 2011-08-30 14:43:28 |