OFFSET
1,3
COMMENTS
Not known to be infinite.
Stan Wagon observed in an e-mail message to me (January 1 2022) that 2022 has this property, and remarked that this "will not happen again for a very long time". - Jeffrey Shallit, Jan 02 2022
LINKS
Rémy Sigrist, Table of n, a(n) for n = 1..10000
EXAMPLE
The base-3 representation of 2022 is 2202220, and 2022 is a subsequence of that.
PROG
(PARI) is(n) = { if (n && vecmax(digits(n))>=3, return (0)); my (t=n); while (n && t, if (n%10==t%3, n\=10); t\=3); n==0 } \\ Rémy Sigrist, Jan 02 2022
(Python)
from itertools import count, islice, product
def ok(n): # after _Remy Sigrist_
if n and int(max(str(n))) >= 3: return False
t = n
while n and t:
if n%10 == t%3:
n //= 10
t //= 3
return n == 0
def agen(): # generator of terms
yield 0
for d in count(1):
for first in "12":
for rest in product("012", repeat=d-1):
k = int(first + "".join(rest))
if ok(k):
yield k
print(list(islice(agen(), 46))) # Michael S. Branicky, Jan 02 2022
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Jeffrey Shallit, Jan 02 2022
EXTENSIONS
a(1) = 0 prepended by Rémy Sigrist, Jan 02 2022
STATUS
approved