OFFSET
1,4
COMMENTS
The same sequence is obtained by looking at the values following each occurrence of each positive integer; and that sequence is this sequence plus one.
Every positive integer occurs infinitely many times. - Ivan Neretin, May 02 2016
LINKS
Alois P. Heinz, Table of n, a(n) for n = 1..10000
MAPLE
a:= proc() local a, c, t;
c:= proc() 0 end; c(0):=1;
a:= proc(n) option remember;
if n=1 then 0
else t:= 1+a(c(a(n-1)));
c(t):= c(t)+1; t
fi
end
end():
seq(a(n), n=1..120); # Alois P. Heinz, Mar 15 2014
MATHEMATICA
a[_] = 0; nmax = 120;
Do[a[i+1] = 1 + a[Sum[Boole[a[j] == a[i]], {j, 1, i}]], {i, 1, nmax-1}];
Table[a[n], {n, 1, nmax}] (* Jean-François Alcover, Apr 28 2022 *)
PROG
(PARI) al(n)={local(r=vector(n), i, j);
for(i=1, n-1, r[i+1]=1+r[sum(j=1, i, if(r[j]==r[i], 1, 0))]);
r}
(Python)
from collections import Counter
from itertools import count, islice
def agen(): # generator of terms
an, a, c = 0, dict(), Counter()
for n in count(1):
yield an
a[n] = an
c[an] += 1
an = a[c[an]] + 1
print(list(islice(agen(), 100))) # Michael S. Branicky, Jul 12 2024
CROSSREFS
KEYWORD
nonn
AUTHOR
Franklin T. Adams-Watters, Mar 14 2014
STATUS
approved