login
A392476
a(n) = a(n-1) - a(a(n-1)) if a(n-1) has appeared exactly once; otherwise a(n) = number of times a(n-1) has appeared; a(0) = 0.
1
0, 0, 2, 0, 3, 3, 2, 2, 3, 3, 4, 1, 1, 2, 4, 2, 5, 2, 6, 4, 3, 5, 2, 7, 5, 3, 6, 2, 8, 5, 4, 4, 5, 5, 6, 3, 7, 2, 9, 6, 4, 6, 5, 7, 3, 8, 2, 10, 6, 6, 7, 4, 7, 5, 8, 3, 9, 2, 11, 10, 2, 12, 11, 2, 13, 11, 3, 10, 3, 11, 4, 8, 4, 9, 3, 12, 2, 14, 10, 4, 10, 5, 9
OFFSET
0,3
LINKS
PROG
(Python)
from collections import Counter
from itertools import islice
def agen(): # generator of terms
a, c = [0], Counter()
while True:
yield a[-1]
c[a[-1]] += 1
a.append(a[-1] - a[a[-1]] if c[a[-1]] == 1 else c[a[-1]])
print(list(islice(agen(), 100))) # Michael S. Branicky, Feb 15 2026
CROSSREFS
Sequence in context: A326926 A347564 A105569 * A068455 A329098 A038073
KEYWORD
nonn,easy
AUTHOR
Austin Blake, Feb 14 2026
STATUS
approved