OFFSET
1,2
COMMENTS
The process is identical to that of A090569 where n persons are arranged on a line and every second person is eliminated. When we reach the end of the line the direction is reversed without double-counting the person at the end. a(n) is the order in which the person originally first in line is eliminated.
LINKS
Chris Groƫr, The Mathematics of Survival: From Antiquity to the Playground, Amer. Math. Monthly, 110 (No. 9, 2003), 812-825.
FORMULA
For n=4m then a(n) = 3*n/4;
for n=4m+1 then a(n) = a(1+(n-1)/4) + 3*(n-1)/4;
for n=4m+2 then a(n) = a(1+(n-2)/4) + 3*(n-2)/4 + 1;
for n=4m+3 then a(n) = 3*(n-3)/4 + 2.
EXAMPLE
If there are 7 persons to begin with, they are eliminated in the following order: 2,4,6,5,1,7,3. So the first person (the person originally first in line) is eliminated as number 5. Therefore a(7) = 5.
MATHEMATICA
t = {1}; Do[AppendTo[t, Switch[Mod[n, 4], 0, 3*n/4, 1, t[[1 + (n-1)/4]] + 3*(n-1)/4, 2, t[[1 + (n-2)/4]] + 3*(n-2)/4 + 1, 3, 3*(n-3)/4 + 2, 4, Mod[n, 4] + 1]], {n, 2, 100}]; t (* T. D. Noe, May 17 2013 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Marcus Hedbring, May 08 2013
STATUS
approved