This is a variant of the Josephus problem. There are players in a line. Beginning with the first player, move from left to right, removing every player. Change the direction at the end of the line and again remove every player. Denote by the position of the last player remaining.
You can see how players are removed with the "demo" button. With the "graph" button you can see the graphs of for and . You can also see the combination of all the graphs for .
Fix the number and choose "graph" to see the graph of the list . For the graph is very simple and beautiful. See the first snapshot for the case of . For other values of the graphs are quite complicated. See the second snapshot for .
Combining all the graphs for with different colors gives a very beautiful graph. The picture in the third snapshot is for .
As far as the authors know, the first paper on the linear Josephus problem is C. Groer, "Mathematics of Survival," American Mathematical Monthly,110, 2003.
For research on the variants of the Josephus problem, please see the following two papers written by the authors:
R. Miyadera, S. Hashiba, and D. Minematsu, "How High School Students Can Discover Original Ideas of Mathematics Using Mathematica," Mathematica in Education and Research, 11(3), 2006.
H. Matsui, T. Yamauchi, S. Tatsumi, T. Inoue, M. Naito, and R. Miyadera, "Interesting Variants of the Josephus Problem," Kokyuroku (to be published).