login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
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
print(list(islice(agen(), 46))) # Michael S. Branicky, Jan 02 2022
CROSSREFS
Cf. A038103, which deals with contiguous substrings instead of subsequences.
Sequence in context: A347024 A009342 A357486 * A306105 A038103 A307254
KEYWORD
nonn,base
AUTHOR
Jeffrey Shallit, Jan 02 2022
EXTENSIONS
a(1) = 0 prepended by Rémy Sigrist, Jan 02 2022
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified August 11 14:00 EDT 2024. Contains 375069 sequences. (Running on oeis4.)