A383670 Limiting word, as a sequence, obtained by prefixing with 0 the limiting sequence of s(n) defined by s(0) = 0, s(1) = 12, s(n) = the concatenation of s(n - 1) and s(n - 2).
0, 1, 2, 0, 1, 2, 1, 2, 0, 1, 2, 0, 1, 2, 1, 2, 0, 1, 2, 1, 2, 0, 1, 2, 0, 1, 2, 1, 2, 0, 1, 2, 0, 1, 2, 1, 2, 0, 1, 2, 1, 2, 0, 1, 2, 0, 1, 2, 1, 2, 0, 1, 2, 1, 2, 0, 1, 2, 0, 1, 2, 1, 2, 0, 1, 2, 0, 1, 2, 1, 2, 0, 1, 2, 1, 2, 0, 1, 2, 0, 1, 2, 1, 2, 0, 1
Offset: 1
Examples
s(0) = 1, s(1) = 12, s(2) = 120, s(3) = 12012, etc., so that the limiting word with 0 prefixed is 0120120120...
Crossrefs
Programs
-
Mathematica
s[0] = "0"; s[1] = "12"; s[n_] := StringJoin[s[n - 1], s[n - 2]]; Join[{0}, IntegerDigits[FromDigits[s[10]]]]
-
Python
from math import isqrt def A276885(n): return n+(n-1+isqrt(5*(n-1)**2)&-2) def A001950(n): return (n+isqrt(5*n**2)>>1)+n def A383670(n): def bsearch(f, n): kmin, kmax = 0, 1 while f(kmax) <= n: kmax <<= 1 kmin = kmax>>1 while True: kmid = kmax+kmin>>1 if f(kmid) > n: kmax = kmid else: kmin = kmid if kmax-kmin <= 1: break return kmin for i, f in enumerate((A276885, A001950)): if f(bsearch(f, n))==n: return i return 2 # Chai Wah Wu, May 21 2025
Comments