cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A350508 Numbers whose base-10 representation is a (scattered) subsequence of their base-3 representation.

This page as a plain text file.
%I A350508 #17 Jan 02 2022 14:13:05
%S A350508 0,1,2,10,20,21,100,102,110,111,210,211,212,220,221,222,1000,1010,
%T A350508 1011,1020,1021,1022,1110,1111,1112,1121,1122,2000,2001,2010,2011,
%U A350508 2012,2021,2022,12101,12102,12111,12112,12120,12121,12122,12201,12202,12221,12222,20220
%N A350508 Numbers whose base-10 representation is a (scattered) subsequence of their base-3 representation.
%C A350508 Not known to be infinite.
%C A350508 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
%H A350508 Rémy Sigrist, <a href="/A350508/b350508.txt">Table of n, a(n) for n = 1..10000</a>
%e A350508 The base-3 representation of 2022 is 2202220, and 2022 is a subsequence of that.
%o A350508 (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
%o A350508 (Python)
%o A350508 from itertools import count, islice, product
%o A350508 def ok(n): # after _Remy Sigrist_
%o A350508     if n and int(max(str(n))) >= 3: return False
%o A350508     t = n
%o A350508     while n and t:
%o A350508         if n%10 == t%3:
%o A350508             n //= 10
%o A350508         t //= 3
%o A350508     return n == 0
%o A350508 def agen(): # generator of terms
%o A350508     yield 0
%o A350508     for d in count(1):
%o A350508         for first in "12":
%o A350508             for rest in product("012", repeat=d-1):
%o A350508                 k = int(first + "".join(rest))
%o A350508                 if ok(k):
%o A350508                     yield k
%o A350508 print(list(islice(agen(), 46))) # _Michael S. Branicky_, Jan 02 2022
%Y A350508 Cf. A038103, which deals with contiguous substrings instead of subsequences.
%K A350508 nonn,base
%O A350508 1,3
%A A350508 _Jeffrey Shallit_, Jan 02 2022
%E A350508 a(1) = 0 prepended by _Rémy Sigrist_, Jan 02 2022