%I
%S 1,3,5,8,13,20,25,32,37,42,54,66,71,83,95,107,124,136,153,165,177,194,
%T 206,223,235,252,293,322,363,392,421,462,491,532,561,602,631,660,701,
%U 730,771,800,829,870,899,940,969,1010,1039,1068,1109,1138,1179,1208
%N Index sequence for limitreversing the A006337; see Comments.
%C Suppose S = (s(0), s(1), s(2),...) is an infinite sequence such that every finite block of consecutive terms occurs infinitely many times in S. (It is assumed that A006337 is such a sequence.) Let B = B(m,k) = (s(mk), s(mk+1),...,s(m)) be such a block, where m >= 0 and k >= 0. Let m(1) be the least i > m such that (s(ik), s(ik+1),...,s(i)) = B(m,k), and put B(m(1),k+1) = (s(m(1)k1), s(m(1)k),...,s(m(1))). Let m(2) be the least i > m(1) such that (s(ik1), s(ik),...,s(i)) = B(m(1),k+1), and put B(m(2),k+2) = (s(m(2)k2), s(m(2)k1),...,s(m(2))). Continuing in this manner gives a sequence of blocks B(m(n),k+n). Let B'(n) = reverse(B(m(n),k+n)), so that for n >= 1, B'(n) comes from B'(n1) by suffixing a single term; thus the limit of B'(n) is defined; we call it the "limitreverse of S with initial block B(m,k)", denoted by S*(m,k), or simply S*. (Since Beatty sequences are usually written with offset 1, the above definition is adapted accordingly, so that s(n) = A006337(n+1) for n >= 0.)
%C ...
%C The sequence (m(i)), where m(0) = 1, is the "index sequence for limitreversing S with initial block B(m,k)" or simply the index sequence for S*, as in A245934.
%e S = A006337 (reindexed to start with s(0) = 1, with B = (s(0)); that is, (m,k) = (0,0); S = (1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 2,...)
%e B'(0) = (1)
%e B'(1) = (2,1)
%e B'(2) = (1,2,1)
%e B'(3) = (1, 2, 1, 1)
%e B'(4) = (1, 2, 1, 1, 2)
%e B'(5) = (1, 2, 1, 1, 2, 1)
%e S* = (1, 2, 1, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 2, 1, 1, 2, 1,...),
%e with index sequence (1, 3, 5, 8, 13, 20, 25, 32, 37,...)
%t z = 140; seqPosition2[list_, seqtofind_] := Last[Last[Position[Partition[list, Length[#], 1], Flatten[{___, #, ___}], 1, 2]]] &[seqtofind]; x = Sqrt[2]; s = Differences[Table[Floor[n*x], {n, 1, z^2}]]; ans = Join[{s[[p[0] = pos = seqPosition2[s, #]  1]]}, #] &[{s[[1]]}]; cfs = Table[s = Drop[s, pos  1]; ans = Join[{s[[p[n] = pos = seqPosition2[s, #]  1]]}, #] &[ans], {n, z}]; q = Accumulate[Join[{1}, Table[p[n], {n, 0, z}]]] (* A245934 *)
%t q1 = Differences[q] (* A245935 *)
%Y Cf. A006337, A245933, A245935, A245921.
%K nonn
%O 1,2
%A _Clark Kimberling_ and _Peter J. C. Moses_, Aug 07 2014
