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.

A038103 Numbers k such that k is a substring of its base-3 representation.

This page as a plain text file.
%I A038103 #28 Jan 09 2022 22:48:26
%S A038103 0,1,2,10,20,21,102,110,210,211,212,220,1011,1112,1121,2022,12101,
%T A038103 12102,12112,12122,10121021,10121022,12222212,102121110,102121120,
%U A038103 200121022,1001120220,2011001102,2012012221,2100221021,2102111111
%N A038103 Numbers k such that k is a substring of its base-3 representation.
%H A038103 Hans Havermann, <a href="/A038103/b038103.txt">Table of n, a(n) for n = 1..210</a> (terms 1..151 from Giovanni Resta).
%H A038103 Hans Havermann, <a href="/A038103/a038103.pdf">pdf file showing the corresponding A350573 terms and illustrating the ternary embeddings</a> (for terms 1..210).
%e A038103 12101 = base 10 -> 121{12101}2 = base 3.
%o A038103 (Python)
%o A038103 from sympy.ntheory.digits import digits
%o A038103 from itertools import count, islice, product
%o A038103 def agen(): # generator of terms
%o A038103     yield 0
%o A038103     for d in count(1):
%o A038103         for first in "12":
%o A038103             for rest in product("012", repeat=d-1):
%o A038103                 s = first + "".join(rest)
%o A038103                 if s in "".join(str(d) for d in digits(int(s), 3)[1:]):
%o A038103                     yield int(s)
%o A038103 print(list(islice(agen(), 31))) # _Michael S. Branicky_, Jan 08 2022
%o A038103 (Python)
%o A038103 from itertools import count, islice
%o A038103 from gmpy2 import digits
%o A038103 def A038103_gen(): return (int(s) for s in (digits(n,3) for n in count(0)) if s in digits(int(s),3))
%o A038103 A038103_list = list(islice(A038103_gen(),30)) # _Chai Wah Wu_, Jan 09 2022
%Y A038103 Cf. A038102-A038106, A228050-A228052, A227549, A350573.
%K A038103 nonn,base
%O A038103 1,3
%A A038103 _Patrick De Geest_, Feb 15 1999