login
A038103
Numbers k such that k is a substring of its base-3 representation.
5
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,3
LINKS
Hans Havermann, Table of n, a(n) for n = 1..210 (terms 1..151 from Giovanni Resta).
EXAMPLE
12101 = base 10 -> 121{12101}2 = base 3.
PROG
(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
KEYWORD
nonn,base
AUTHOR
Patrick De Geest, Feb 15 1999
STATUS
approved