login
A370401
Lexicographically earliest sequence of distinct nonnegative terms such that the first digit of a(n) is present in a(n+1).
6
0, 10, 1, 11, 12, 13, 14, 15, 16, 17, 18, 19, 21, 2, 20, 22, 23, 24, 25, 26, 27, 28, 29, 32, 3, 30, 31, 33, 34, 35, 36, 37, 38, 39, 43, 4, 40, 41, 42, 44, 45, 46, 47, 48, 49, 54, 5, 50, 51, 52, 53, 55, 56, 57, 58, 59, 65, 6, 60, 61, 62, 63, 64, 66, 67, 68, 69, 76, 7, 70, 71, 72, 73, 74, 75, 77, 78, 79, 87, 8, 80
OFFSET
1,2
LINKS
Eric Angelini, Talking to me?, personal blog, Feb 2024.
EXAMPLE
a(1) = 0 and the leftmost digit "0" is present in the next term (10)
a(2) = 10 and the leftmost digit "1" is present in the next term ( 1)
a(3) = 1 and the leftmost digit "1" is present in the next term (11)
a(4) = 11 and the leftmost digit "1" is present in the next term (12)
a(5) = 12 and the leftmost 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, First@IntegerDigits@a[n-1]], k++]; k); Array[a, 81]
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)[0], 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(), 81))) # Michael S. Branicky, Feb 18 2024
CROSSREFS
KEYWORD
base,nonn
AUTHOR
STATUS
approved