OFFSET
1,6
FORMULA
a(4n+1..4n+4) = 1, n+1, 0, n+1 for n >= 1. - Michael S. Branicky, Jun 12 2022
EXAMPLE
a(10) = 3 because a(9) = 1 and 3 other 1s appear before that.
PROG
(Python)
from collections import Counter
from itertools import count, islice
def agen(): # generator of terms
anprev, an, inventory = None, 1, Counter()
for n in count(2):
yield an
anprev, an = an, inventory[an]
inventory[anprev] += 1
print(list(islice(agen(), 80))) # Michael S. Branicky, Jun 09 2022
(PARI) lista(nn) = my(va=vector(nn)); va[1] = 1; for (n=2, nn, my(vb = vector(n-2, k, va[k])); va[n] = #select(x->(x==va[n-1]), vb); ); va; \\ Michel Marcus, Jun 13 2022
CROSSREFS
KEYWORD
nonn
AUTHOR
Eric Fox, Jun 09 2022
EXTENSIONS
a(54) and beyond from Michael S. Branicky, Jun 12 2022
STATUS
approved