The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
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!)
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. 1
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, 28, 29, 30, 22, 31, 32, 34, 35, 36, 37, 38, 39, 40, 33, 41, 42, 43, 45, 46, 47, 48, 49, 50, 44, 51, 52, 53, 54, 56, 57, 58, 59, 60, 55, 61, 62, 63, 64, 65, 67, 68 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,2
COMMENTS
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?
The last term is a(1023445778) = 1023456789, the least missing number is 1000000010. - Rémy Sigrist, Jun 03 2022
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
LINKS
Rémy Sigrist, C++ program
EXAMPLE
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.
PROG
(PARI) isok(k, prev) = {my(d=digits(k)); for (i=1, #d, if (!vecsearch(prev, d[i]), return(1)); ); return(0); }
find(va, n) = {my(k=1, prev=Set(digits(va[n-1]))); while (vecsearch(Set(va), k) || !isok(k, prev), k++); k; }
lista(nn) = {my(va = vector(nn)); va[1] = 1; for (n=2, nn, va[n] = find(va, n); ); va; } \\ Michel Marcus, May 11 2022
(C++) See Links section.
(Python)
from itertools import count, islice
def agen(): # generator of terms
an, aset, mu, mink = 0, set(), [10, 1, 2, 3, 4, 5, 6, 7, 8, 9], 1
while set(str(an)) != set("0123456789"):
notin = set("0123456789") - set(str(an))
an = min(mu[i] for i in range(10) if str(i) in notin)
yield an; aset.add(an)
for i in range(10): # update min unused containing digit i
while mu[i] in aset or str(i) not in str(mu[i]): mu[i] += 1
for k in range(mink, min(mu)): aset.discard(k)
mink = min(mu)
print(list(islice(agen(), 67))) # Michael S. Branicky, Aug 26 2022
CROSSREFS
Sequence in context: A194845 A194056 A020753 * A331162 A337843 A101947
KEYWORD
nonn,base,fini
AUTHOR
Sergio Pimentel, May 09 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 June 12 20:44 EDT 2024. Contains 373360 sequences. (Running on oeis4.)