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”).

A370400
Lexicographically earliest sequence of distinct nonnegative terms such that the last digit of a(n) is present in a(n+1).
6
0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 101, 1, 11, 12, 2, 21, 13, 3, 23, 31, 14, 4, 24, 34, 41, 15, 5, 25, 35, 45, 51, 16, 6, 26, 36, 46, 56, 61, 17, 7, 27, 37, 47, 57, 67, 71, 18, 8, 28, 38, 48, 58, 68, 78, 81, 19, 9, 29, 39, 49, 59, 69, 79, 89, 91, 102, 22, 32, 42, 52, 62, 72, 82, 92, 112, 120, 103, 33
OFFSET
1,2
COMMENTS
This is not A156819.
LINKS
Eric Angelini, Talking to me?, personal blog, Feb 2024.
EXAMPLE
a(12) = 101 and the rightmost digit "1" is present in the next term ( 1)
a(13) = 1 and the rightmost digit "1" is present in the next term (11)
a(14) = 11 and the rightmost digit "1" is present in the next term (12)
a(15) = 12 and the rightmost digit "2" is present in the next term ( 2)
a(16) = 2 and the rightmost digit "2" is present in the next term (21)
a(17) = 21 and the rightmost digit "1" is present in the next term (13), etc.
MATHEMATICA
a[1]=0; a[n_]:=a[n]=(k=1; While[MemberQ[Array[a, n-1], k]|| FreeQ[IntegerDigits@k, Mod[a[n-1], 10]], k++]; k); Array[a, 79]
PROG
(Python)
from itertools import count, islice
def agen(): # generator of terms
an, aset, mink = 0, set(), 1
while True:
yield an
aset.add(an)
t, k = str(an%10), mink
an = next(k for k in count(mink) if k not in aset and t in str(k))
while mink in aset: mink += 1
print(list(islice(agen(), 79))) # Michael S. Branicky, Feb 18 2024
CROSSREFS
KEYWORD
base,nonn
AUTHOR
STATUS
approved