OFFSET
0,7
COMMENTS
In the first 10000 terms the largest entry is 9040, which is the number of terms between the two appearances of 217. The longest run of nonzero values is 19, starting at a(9740) = 3 and ending at a(9758) = 6400. The smallest number not appearing is 258.
LINKS
Scott R. Shannon, Table of n, a(n) for n = 0..10000
EXAMPLE
a(3) = 1 as there is 1 term between a(3-1) = a(2) = 0 and a(0) = 0.
a(5) = 0 as there are no terms between a(5-1) = a(4) = 1 and a(3) = 1.
a(7) = 0 as a(7-1) = a(6) = 2 has only appeared once up to n = 7.
a(12) = 4 as there are 4 terms between a(12-1) = a(11) = 2 and a(6) = 2.
a(22) = 11 as there are 11 terms between a(22-1) = a(21) = 3 and a(9) = 3.
MAPLE
a:= proc(n) option remember; local t, j;
if n<2 then n else t:= a(n-1);
for j from 2 to n do
if a(n-j)=t then return j-2 fi
od; 0
fi
end:
seq(a(n), n=0..100); # Alois P. Heinz, Oct 04 2019
MATHEMATICA
a = {0, 1}; While[Length@a < 90, p = Flatten@ Position[Reverse@ a, Last@a, 1, 2]; AppendTo[a, If[ Length@p == 1, 0, p[[2]] - p[[1]] - 1]]]; a (* Giovanni Resta, Oct 04 2019 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Scott R. Shannon, Oct 04 2019
STATUS
approved