OFFSET
1,4
COMMENTS
MAPLE
ECKb:=proc(a) local b, i, m, n;
if whattype(a) <> list then RETURN([]); fi:
b:=[0];
for n from 2 to nops(a) do
# has a(n) appeared before?
m:=0;
for i from n-1 by -1 to 1 do
if (a[i]=a[n]) then m:=n-i; break; fi
od:
b:=[op(b), m];
od:
RETURN(b);
end:
CROSSREFS
KEYWORD
nonn
AUTHOR
N. J. A. Sloane, Oct 22 2010
STATUS
approved