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.

A353888 a(n) is the least positive integer not occurring earlier in the sequence that contains at least one digit not in a(n-1); a(1)=1.

This page as a plain text file.
%I A353888 #31 Sep 14 2022 10:54:08
%S A353888 1,2,3,4,5,6,7,8,9,10,12,13,14,15,16,17,18,19,20,11,21,23,24,25,26,27,
%T A353888 28,29,30,22,31,32,34,35,36,37,38,39,40,33,41,42,43,45,46,47,48,49,50,
%U A353888 44,51,52,53,54,56,57,58,59,60,55,61,62,63,64,65,67,68
%N A353888 a(n) is the least positive integer not occurring earlier in the sequence that contains at least one digit not in a(n-1); a(1)=1.
%C A353888 The sequence is finite. 1023456789 should be the last number in the sequence, although many smaller numbers should fail to appear.  How many terms are in the complete sequence?
%C A353888 The last term is a(1023445778) = 1023456789, the least missing number is 1000000010. - _Rémy Sigrist_, Jun 03 2022
%C A353888 At that point, the least missing numbers containing the digits 2..9 are 1020001000, 1023001300, 1023401000, 1023450200, 1023456024, 1023456710, 1023456781, 1023456789, resp. - _Michael S. Branicky_, Aug 26 2022
%H A353888 Sergio Pimentel, <a href="/A353888/b353888.txt">Table of n, a(n) for n = 1..10000</a>
%H A353888 Rémy Sigrist, <a href="/A353888/a353888.txt">C++ program</a>
%e A353888 a(11)=12 since a(10)=10 and 12 is the smallest number not occurring earlier in the sequence that contains a digit (2) that is not in 10.
%o A353888 (PARI) isok(k, prev) = {my(d=digits(k)); for (i=1, #d, if (!vecsearch(prev, d[i]), return(1));); return(0);}
%o A353888 find(va, n) = {my(k=1, prev=Set(digits(va[n-1]))); while (vecsearch(Set(va), k) || !isok(k, prev), k++); k;}
%o A353888 lista(nn) = {my(va = vector(nn)); va[1] = 1; for (n=2, nn, va[n] = find(va, n);); va;} \\ _Michel Marcus_, May 11 2022
%o A353888 (C++) See Links section.
%o A353888 (Python)
%o A353888 from itertools import count, islice
%o A353888 def agen():  # generator of terms
%o A353888     an, aset, mu, mink = 0, set(), [10, 1, 2, 3, 4, 5, 6, 7, 8, 9], 1
%o A353888     while set(str(an)) != set("0123456789"):
%o A353888         notin = set("0123456789") - set(str(an))
%o A353888         an = min(mu[i] for i in range(10) if str(i) in notin)
%o A353888         yield an; aset.add(an)
%o A353888         for i in range(10):  # update min unused containing digit i
%o A353888             while mu[i] in aset or str(i) not in str(mu[i]): mu[i] += 1
%o A353888         for k in range(mink, min(mu)): aset.discard(k)
%o A353888         mink = min(mu)
%o A353888 print(list(islice(agen(), 67))) # _Michael S. Branicky_, Aug 26 2022
%Y A353888 Cf. A184992, A162501, A130571, A107353.
%K A353888 nonn,base,fini
%O A353888 1,2
%A A353888 _Sergio Pimentel_, May 09 2022