%I M5181 #31 Jan 24 2016 23:55:14
%S 1,25,2,4,3,22,6,8,10,5,32,83,44,14,7,66,169,11,49595,9,69,16,24,12,
%T 43,47,7598,15,133,109,13,198,19,33,18,23,58,65,60,93167,68,17,1523,
%U 39,75,20,99,34,117,123
%N Step at which n is expelled in Kimberling's puzzle (A035486).
%D R. K. Guy, Unsolved Problems Number Theory, Sect E35.
%D N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
%H Enrique Pérez Herrero [1..11000], Goudout Élie [11001..20000], <a href="/A006852/b006852.txt">Table of n, a(n) for n = 1..20000</a>
%H D. Gale, <a href="http://dx.doi.org/10.1007/978-1-4612-2192-0">Tracking the Automatic Ant: And Other Mathematical Explorations</a>, ch. 5, p. 27. Springer, 1998. [From _Enrique Pérez Herrero_, Mar 28 2010]
%H C. Kimberling, <a href="https://cms.math.ca/crux/backfile/Crux_v17n02_Feb.pdf">Problem 1615</a>, Crux Mathematicorum, Vol. 17 (2) 44 1991.
%F a(n) >= floor((n+4)/3), n is expulsed from the unshuffled zone. - _Enrique Pérez Herrero_, Feb 25 2010
%t L[n_] := L[n] = (
%t i = Floor[(n + 4)/3];
%t j = Floor[(2*n + 1)/3];
%t While[(i != j), j = Max[2*(i - j), 2*(j - i) - 1]; i++ ];
%t Return[i];
%t ) A006852[n_] := L[n]
%t (* _Enrique Pérez Herrero_, Mar 28 2010 *)
%o (PARI) A006852(n)=
%o {
%o my(i,j);
%o i=floor((n+4)/3);
%o j=floor((2*n+1)/3);
%o while((i!=j),
%o j=max(2*i-2*j,-1-2*i+2*j);
%o i++;
%o ); return(i); }
%o \\ _Enrique Pérez Herrero_, Feb 25 2010
%Y Cf. A007063.
%Y Cf. A175312. - _Enrique Pérez Herrero_, Mar 28 2010
%K nonn,nice
%O 1,2
%A _N. J. A. Sloane_
%E 7593 corrected to 7598 by _Hans Havermann_, July 1998