login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A362551
a(0)=0. For each digit d in the sequence, append the smallest unused integer such that its last digit equals d.
2
0, 10, 1, 20, 11, 2, 30, 21, 31, 12, 3, 40, 22, 41, 13, 51, 61, 32, 23, 4, 50, 42, 52, 14, 71, 81, 33, 5, 91, 6, 101, 43, 62, 72, 53, 24, 15, 60, 34, 82, 25, 92, 111, 44, 7, 121, 8, 131, 63, 73, 35, 9, 141, 16, 151, 70, 161, 54, 83, 26, 102, 17, 112, 45, 93
OFFSET
0,2
COMMENTS
This sequence is a permutation of the nonnegative integers.
EXAMPLE
a(0) = 0
a(1) = 10 (d=0 from a(0)=0, smallest integer other than 0 that ends with 0).
a(2) = 1 (d=1 from a(1)=10, smallest integer that ends with a 1).
a(3) = 20 (d=0 from a(1)=10, smallest integer other than 0 and 10 that ends with 0).
a(4) = 11 (d=1 from a(2)=1, smallest integer other than 1 that ends with 1).
a(5) = 2 (d=2 from a(3)=20, smallest integer that ends with 2).
a(6) = 30 (d=0 from a(3)=20, smallest integer other than 0, 10, and 20 that ends with 0).
PROG
(Python)
from itertools import count, islice
def agen(): # generator of terms
s, lastd = "0", [(k for k in count(i, 10)) for i in range(10)]
for n in count(0):
an = next(lastd[int(s[0])])
s = s[1:] + str(an)
yield an
print(list(islice(agen(), 65))) # Michael S. Branicky, Apr 25 2023
CROSSREFS
Sequence in context: A317054 A292690 A362371 * A036188 A013617 A243002
KEYWORD
nonn,base,easy
AUTHOR
Gavin Lupo, Apr 24 2023
STATUS
approved