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.

A038103 Numbers k such that k is a substring of its base-3 representation.

Original entry on oeis.org

0, 1, 2, 10, 20, 21, 102, 110, 210, 211, 212, 220, 1011, 1112, 1121, 2022, 12101, 12102, 12112, 12122, 10121021, 10121022, 12222212, 102121110, 102121120, 200121022, 1001120220, 2011001102, 2012012221, 2100221021, 2102111111
Offset: 1

Views

Author

Patrick De Geest, Feb 15 1999

Keywords

Examples

			12101 = base 10 -> 121{12101}2 = base 3.
		

Crossrefs

Programs

  • Python
    from sympy.ntheory.digits import digits
    from itertools import count, islice, product
    def agen(): # generator of terms
        yield 0
        for d in count(1):
            for first in "12":
                for rest in product("012", repeat=d-1):
                    s = first + "".join(rest)
                    if s in "".join(str(d) for d in digits(int(s), 3)[1:]):
                        yield int(s)
    print(list(islice(agen(), 31))) # Michael S. Branicky, Jan 08 2022
    
  • Python
    from itertools import count, islice
    from gmpy2 import digits
    def A038103_gen(): return (int(s) for s in (digits(n,3) for n in count(0)) if s in digits(int(s),3))
    A038103_list = list(islice(A038103_gen(),30)) # Chai Wah Wu, Jan 09 2022