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.

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

Original entry on oeis.org

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

Views

Author

Clark Kimberling, May 15 2025

Keywords

Comments

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.

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

Cf. A000045, A003849, A047924 (positions of 0), A026356 (positions of 1), A022413 (positions of 2), A383670.

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