|
|
A350508
|
|
Numbers whose base-10 representation is a (scattered) subsequence of their base-3 representation.
|
|
1
|
|
|
0, 1, 2, 10, 20, 21, 100, 102, 110, 111, 210, 211, 212, 220, 221, 222, 1000, 1010, 1011, 1020, 1021, 1022, 1110, 1111, 1112, 1121, 1122, 2000, 2001, 2010, 2011, 2012, 2021, 2022, 12101, 12102, 12111, 12112, 12120, 12121, 12122, 12201, 12202, 12221, 12222, 20220
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
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
|
|
|
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
|
|
CROSSREFS
|
Cf. A038103, which deals with contiguous substrings instead of subsequences.
|
|
KEYWORD
|
nonn,base
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|