|
|
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
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,3
|
|
LINKS
|
|
|
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)
(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))
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,base
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|