OFFSET
1,4
COMMENTS
LINKS
A.H.M. Smeets, Table of n, a(n) for n = 1..20000
EXAMPLE
n convergent decimal expansion a(n)
== ============= ==================== ====
1 2 / 1 2.0 0
2 3 / 1 3.0 -1
3 8 / 3 2.66... 1
4 43 / 16 2.687... 2
5 51 / 19 2.684... 2
6 94 / 35 2.6857... 3
7 239 / 89 2.6853... 3
8 333 / 124 2.68548... 4
9 572 / 213 2.68544... 4
10 2049 / 763 2.6854521... 6
oo lim = A002210 2.685452001065306... --
PROG
(Python)
i, cf = 0, []
while i <= 20100:
....c = A002211(i)
....cf, i = cf+[c], i+1
p0, p1, q0, q1, i, base = cf[0], 1, 1, 0, 1, 10
while i <= 20100:
....p0, p1, q0, q1, i = cf[i]*p0+p1, p0, cf[i]*q0+q1, q0, i+1
a0 = p0//q0
p0 = p0-a0*q0
i, p0, dd = 0, p0*base, [a0]
while i < 21000:
....d, p0, i = p0//q0, (p0%q0)*base, i+1
....dd = dd+[d]
n, pn0, pn1, qn0, qn1 = 1, a0, 1, 1, 0
while n <= 20000:
....p, q = pn0, qn0
....if p//q != a0:
........print(n, "- manual!")
....else:
........i, p, di = 0, (p%q)*base, a0
........while di == dd[i]:
............i, di, p = i+1, p//q, (p%q)*base
........print(n, i-1)
....n, pn0, pn1, qn0, qn1 = n+1, cf[n]*pn0+pn1, pn0, cf[n]*qn0+qn1, qn0
CROSSREFS
KEYWORD
sign,base
AUTHOR
A.H.M. Smeets, Aug 10 2018
STATUS
approved