A383671 The limiting word that starts with 0, as a sequence, generated by s(0) = 0, s(1) = 12, s(n) = concatenation of s(n - 2) and s(n - 1).
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, 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
Offset: 0
Keywords
Examples
Initial subwords: s(0)=0, s(1)=12, s(2)=012, s(3)=12012, s(4)= 01212012, of lengths 1, 2, 3, 5, 8 (Fibonacci numbers).
Crossrefs
Programs
-
Mathematica
s[0] = "0"; s[1] = "12"; s[n_] := StringJoin[s[n - 2], s[n - 1]]; Join[{0}, IntegerDigits[FromDigits[s[10]]]]
-
Python
from math import isqrt def A047924(n): return ((m:=(n+isqrt(5*n**2)>>1)+1)+isqrt(5*m**2)>>1)+m+1 def A026356(n): return (n+1+isqrt(5*(n-1)**2)>>1)+n def A383671(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 if n<3: return n for i, f in enumerate((A047924, A026356)): if f(bsearch(f,n+1))==n+1: return i return 2 # Chai Wah Wu, May 21 2025
Comments