%I #23 Dec 24 2021 08:12:22
%S 2,0,8,50,132,414,171,659,96,361,12311,7224,5896,2954,5804,72387,
%T 12756,1292,4332,3715,2704,1887,5780,9837,11721,1094,70067,32610,
%U 57658,26146,167389,94957,36588,19663,35588,9627,108296,51653,38147,54788,81871,15502
%N Index of first occurrence of n appearing twice in succession in van Eck's sequence (A181391), or 0 if it never occurs.
%C With V=A181391, a(n) is the smallest number m such that V(m) = V(m-1) = n.
%C Since van Eck's sequence is generated by considering the gap between identical terms reappearing, it is of interest to consider terms of value n which repeat with a gap of length n.
%C When this happens the term is repeated in succession.
%C Some observations that follow from the definition of V:
%C V(a(n)-1-n) = n. The value n has to appear exactly n terms apart in V to make the following term equal to n, e.g., for n=3: "..., 3, 8, 0, 3, 3, ...".
%C V(a(n)+1) = 1. Since the term n appeared twice in a row, the following term of V must be 1.
%C V(a(n)-2) = V(a(n)-n-2) = V(a(n)-2*n-2). The number preceding the repeated terms appears three times with gaps of n.
%C V(a(n)+2) = the number of terms since the previous repeated value of some number (though it may not be the first time it is repeated). So V(a(n)-V(a(n)+2)) = V(a(n)-V(a(n)+2)-1).
%H Rémy Sigrist, <a href="/A308782/b308782.txt">Table of n, a(n) for n = 0..999</a>
%H Rémy Sigrist, <a href="/A308782/a308782.txt">C++ program for A308782</a>
%e With V=A181391 and n=8:
%e V(95) = V(96) = 8. Therefore, a(8) = 96.
%e ---
%e V(a(n)-1-n) = n:
%e a(8) - 1 - 8 = 87.
%e V(87) = 8.
%e ---
%e V(a(n)+1) = 1:
%e a(8) + 1 = 97.
%e V(97) = 1.
%e ---
%e V(a(n)-2) = V(a(n)-n-2) = V(a(n)-2*n-2):
%e a(8) - 2 = 94.
%e a(8) - 8 - 2 = 86.
%e a(8) - 2*8 - 2 = 78.
%e V(94) = V(86) = V(78) = 3.
%e ---
%e V(a(8)+2) = 46. a(8) - 46 = 50. The previous repeated terms in V are V(50) = V(49) = 5.
%o (C++) See Links section.
%Y Cf. A181391 (van Eck's sequence).
%K nonn
%O 0,1
%A _Deron Stewart_, Jun 24 2019