OFFSET
1,2
LINKS
Michael S. Branicky, Table of n, a(n) for n = 1..10000
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
Eric Angelini and Giorgos Kalogeropoulos, Feb 17 2024
STATUS
approved