cp's OEIS Frontend

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.

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).

This page as a plain text file.
%I A383670 #26 Sep 04 2025 08:40:51
%S A383670 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,
%T A383670 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,
%U A383670 2,1,2,0,1,2,1,2,0,1,2,0,1,2,1,2,0,1
%N 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).
%C A383670 The length of the n-th initial subword is A000045(n), for n>=1.
%e A383670 s(0) = 1, s(1) = 12, s(2) = 120, s(3) = 12012, etc., so that the limiting word with 0 prefixed is 0120120120...
%t A383670 s[0] = "0"; s[1] = "12"; s[n_] := StringJoin[s[n - 1], s[n - 2]];
%t A383670 Join[{0}, IntegerDigits[FromDigits[s[10]]]]
%o A383670 (Python)
%o A383670 from math import isqrt
%o A383670 def A276885(n): return n+(n-1+isqrt(5*(n-1)**2)&-2)
%o A383670 def A001950(n): return (n+isqrt(5*n**2)>>1)+n
%o A383670 def A383670(n):
%o A383670     def bsearch(f, n):
%o A383670         kmin, kmax = 0, 1
%o A383670         while f(kmax) <= n:
%o A383670             kmax <<= 1
%o A383670         kmin = kmax>>1
%o A383670         while True:
%o A383670             kmid = kmax+kmin>>1
%o A383670             if f(kmid) > n:
%o A383670                 kmax = kmid
%o A383670             else:
%o A383670                 kmin = kmid
%o A383670             if kmax-kmin <= 1:
%o A383670                 break
%o A383670         return kmin
%o A383670     for i, f in enumerate((A276885, A001950)):
%o A383670         if f(bsearch(f, n))==n: return i
%o A383670     return 2 # _Chai Wah Wu_, May 21 2025
%Y A383670 Cf. A000045, A003849, A276885 (positions of 0), A001950 (positions of 1), A026352 (positions of 2), A383671.
%K A383670 nonn,changed
%O A383670 1,3
%A A383670 _Clark Kimberling_, May 15 2025