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

Original entry on oeis.org

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

Views

Author

Clark Kimberling, May 15 2025

Keywords

Comments

The length of the n-th initial subword is A000045(n), for n>=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

Cf. A000045, A003849, A276885 (positions of 0), A001950 (positions of 1), A026352 (positions of 2), A383671.

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