This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A383671 #18 May 21 2025 23:36:34 %S A383671 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, %T A383671 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, %U A383671 0,1,2,1,2,0,1,2,1,2,0,1,2,0,1,2,1,2 %N 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). %C A383671 There are two distinct limiting words generated by s(0) = 0, s(1) = 12, s(n) = s(n - 2)s(n - 1). This one is given by s(2n) for n>=0; the other, given by s(2n-1) for n>=0, is 1201201212012... In both limiting words, the length of the n-th initial subword is A000045(n+1), for n>=1. %e A383671 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). %t A383671 s[0] = "0"; s[1] = "12"; s[n_] := StringJoin[s[n - 2], s[n - 1]]; %t A383671 Join[{0}, IntegerDigits[FromDigits[s[10]]]] %o A383671 (Python) %o A383671 from math import isqrt %o A383671 def A047924(n): return ((m:=(n+isqrt(5*n**2)>>1)+1)+isqrt(5*m**2)>>1)+m+1 %o A383671 def A026356(n): return (n+1+isqrt(5*(n-1)**2)>>1)+n %o A383671 def A383671(n): %o A383671 def bsearch(f, n): %o A383671 kmin, kmax = 0, 1 %o A383671 while f(kmax) <= n: %o A383671 kmax <<= 1 %o A383671 kmin = kmax>>1 %o A383671 while True: %o A383671 kmid = kmax+kmin>>1 %o A383671 if f(kmid) > n: %o A383671 kmax = kmid %o A383671 else: %o A383671 kmin = kmid %o A383671 if kmax-kmin <= 1: %o A383671 break %o A383671 return kmin %o A383671 if n<3: return n %o A383671 for i, f in enumerate((A047924, A026356)): %o A383671 if f(bsearch(f,n+1))==n+1: return i %o A383671 return 2 # _Chai Wah Wu_, May 21 2025 %Y A383671 Cf. A000045, A003849, A047924 (positions of 0), A026356 (positions of 1), A022413 (positions of 2), A383670. %K A383671 nonn %O A383671 0,3 %A A383671 _Clark Kimberling_, May 15 2025