Game in a circle $N$ players play a game. They stand in a way such that they form a regular $N$-gon. Players are numbered from $1$ to $N$. The players throw boomerangs in clockwise order, in turns. At first player $1$ throws a boomerang through the center of the polygon. If $N$ is even, then the boomerang hits the player on the opposite side, and the player who got hit leaves the game. If $N$ is odd then the opposite point has no player, so the boomerang flies back to the player who threw it and hits him, making him leave the game. After a player leaves, the game continues with $N-1$ players in the same way (i.e. they again make a regular $(N-1)$-gon). The player who's clockwisely closest to the last player who moved, has the turn now.
The game continues until only one player is left. Is there any closed form expression for the index of the winning player in terms of $N$?
If $f(m)$ denotes the answer, then I figured out a trivial recursion that $f(2n+1)=f(2n)+1$ since in the odd case, player $1$ is out in the first move and then player $2$ moves. But nothing for the even case. Thanks for any help.
First few values: n --> f(n)
2 --> 1
3 --> 2
4 --> 4
5 --> 5
6 --> 1
7 --> 2
8 --> 3
9 --> 4
10 --> 5
11 --> 6
12 --> 8
13 --> 9
14 --> 11
15 --> 12
16 --> 14
 A: Observing the pattern of $n - f(n)$ (at least for n = 1 to 10000 in my simulation) shows that it stays constant, decrements every two steps, then repeats. We notice the sequence
$0, 1, 5, 21, 85, 341, 1365, 5461, $ which is generated by $$a(k) = \frac{4^k - 1}{3}, \qquad\qquad a(k+1) = 4a(k)+1$$
Conjecture: Given $n$, determine $k$ such that $a(k) < n \leq a(k+1)$, then the winning player is:
$$f(n) = \begin{cases}n - a(k) \quad &\mbox{ for }a(k)+1\leq n \leq 2a(k)+1\\
n - a(k)+\lfloor{i/2}\rfloor \quad &\mbox{ for } 2a(k)+2 \leq n \leq a(k+1), n = 2a(k)+i
\end{cases}$$



#Python/SageMath code
def f(n):
  graphList = range(1,n+1); 
  playerIndex = 0
  while len(graphList)>1:
    if len(graphList)%2==0:
        currValue = graphList[playerIndex%len(graphList)]
        oppositeIndex = (len(graphList)/2+playerIndex)%len(graphList)
        del graphList[oppositeIndex]
        playerIndex = (graphList.index(currValue)+1)%len(graphList)
    else: del graphList[playerIndex]
return graphList[0]

