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.

A003157 A self-generating sequence (see Comments in A003156 for the definition).

Original entry on oeis.org

3, 8, 11, 14, 19, 24, 29, 32, 35, 40, 43, 46, 51, 54, 57, 62, 67, 72, 75, 78, 83, 88, 93, 96, 99, 104, 109, 114, 117, 120, 125, 128, 131, 136, 139, 142, 147, 152, 157, 160
Offset: 1

Views

Author

Keywords

Comments

Indices of c in the sequence closed under a -> abc, b -> a, c -> a, starting with a(1) = a; see A092606 where a = 0, b = 2, c = 1. - Philippe Deléham, Apr 12 2004
These are the positions of 1 in A286044; complement of A286045; conjecture: a(n)/n -> 4. - Clark Kimberling, May 07 2017

Examples

			As a word, A286044 = 001000010010010000100..., in which 1 is in positions a(n) for n>=1.  - _Clark Kimberling_, May 07 2017
		

References

  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Programs

  • Mathematica
    s = Nest[Flatten[# /. {0 -> {0, 1}, 1 -> {1, 0}}] &, {0}, 9] (* Thue-Morse, A010060 *)
    w = StringJoin[Map[ToString, s]]
    w1 = StringReplace[w, {"011" -> "0"}]
    st = ToCharacterCode[w1] - 48 (* A286044 *)
    Flatten[Position[st, 0]]  (* A286045 *)
    Flatten[Position[st, 1]]  (* A003157 *)
    (* Clark Kimberling, May 07 2017 *)
  • Python
    def A003157(n):
        def bisection(f,kmin=0,kmax=1):
            while f(kmax) > kmax: kmax <<= 1
            kmin = kmax >> 1
            while kmax-kmin > 1:
                kmid = kmax+kmin>>1
                if f(kmid) <= kmid:
                    kmax = kmid
                else:
                    kmin = kmid
            return kmax
        def f(x):
            c, s = n+x, bin(x)[2:]
            l = len(s)
            for i in range(l&1,l,2):
                c -= int(s[i])+int('0'+s[:i],2)
            return c
        return bisection(f,n,n)+n # Chai Wah Wu, Jan 29 2025

Formula

Numbers n such that A003159(n) is even. a(n) = A003158(n) + 1 = A036554(n) + n. - Philippe Deléham, Feb 22 2004