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