OFFSET
1,1
LINKS
Paolo P. Lava, Table of n, a(n) for n = 1..1000
FORMULA
a(n) = 1 + A171862(n). - Jan Ritsema van Eck, Jul 24 2019
EXAMPLE
Starting with a(1)=1 and a(2)=0 the second occurrence of 1 is for a(4):
1, 0, 0, 1, 3, 0, 3, 2, 0, 3, 3, 1, 8, 0, 5, 0, 2, 9, 0, 3, 9, 3, 2, ...
Starting with a(1)=2 and a(2)=0 the second occurrence of 2 is for a(6):
2, 0, 0, 1, 0, 2, 5, 0, 3, 0, 2, 5, 5, 1, 10, 0, 6, 0, 2, 8, 0, 3, 13, ...
Starting with a(1)=3 and a(2)=0 the second occurrence of 3 is for a(21):
3, 0, 0, 1, 0, 2, 0, 2, 2, 1, 6, 0, 5, 0, 2, 6, 5, 4, 0, 5, 3, 20, 0, ...
MAPLE
P:=proc(q) local a, c, h, i, k, m, n, p, x; m:=60000; a:=Array(1..m); p:=Array(0..m, -1); c:=Array(0..1000);
for k from 0 to 1000 do for i from 0 to m do p[i]:=0; od; for i from 1 to m do a[i]:=0; od;
a[1]:=k; a[2]:=0; p[0]:=2; p[a[1]]:=1; x:=0; for n from 3 to m do h:=p[x]; a[n]:=x; p[x]:=n; x:=0;
if h>0 then x:=n-h; fi; if a[n]=k then c[k]:=x+1; break; fi;
od; od; [seq(c[n], n=0..1000)]; end: P(1);
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Paolo P. Lava, Jul 13 2016
STATUS
approved