A318058 a(n) is the number of decimal places to which the n-th convergent of the continued fraction expansion of the golden section matches the correct value.
0, -1, 0, 1, 1, 1, 2, 2, 2, 3, 2, 4, 4, 5, 5, 5, 6, 5, 7, 7, 8, 7, 9, 9, 9, 10, 10, 10, 11, 10, 12, 12, 13, 12, 13, 14, 15, 14, 15, 16, 16, 16, 17, 17, 17, 18, 18, 19, 18, 20, 20, 21, 21, 21, 22, 22, 23, 23, 24, 23, 24, 25, 25, 26, 26, 27, 27, 27, 28, 28, 29, 29, 29, 30, 30
Offset: 1
Examples
n convergent decimal expansion a(n) == ============= ========================= ==== 1 1 / 1 1.0 0 2 2 / 1 2.0 -1 3 3 / 2 1.5 0 4 5 / 3 1.66 1 5 8 / 5 1.60 1 6 13 / 8 1.62 1 7 21 / 13 1.615 2 8 34 / 21 1.619 2 9 55 / 34 1.617 2 10 89 / 55 1.6181 3 oo lim = A001622 1.6180339887498948482 --
Programs
-
Python
p, q, i, base = 1, 1, 0, 10 while i < 20200: p, q, i = p+q, p, i+1 a0, p, q = p//q, q, p i, p, dd = 0, p*base, [0] while i < 30000: d, p, i = p//q, (p%q)*base, i+1 dd = dd+[d] n, pn, qn = 0, 1, 0 while n < 20000: n, pn, qn = n+1, pn+qn, pn if pn//qn != a0: print(n, "- manual!") else: i, p, q, di = 0, (pn%qn)*base, qn, 0 while di == dd[i]: i, di, p = i+1, p//q, (p%q)*base print(n, i-1)
Comments