Artificial intelligent assistant

Numbers $1,2,3, ...., 2016$ arranged in a circle A student wrote numbers $1,2,3, ...., n$ arranged in a circle, then began with erasing number $1$ then he Leaves $2$ then he erased $3$ and leaves $4$ ...... exemple: if $n=10$ : in the first round he erased $1,3,5,7,9$ , and leaves $2,4,6,8,10$ in the second round he erased $2,6,10$ and leaves $4,8$ in the third round he leaves $4$ because he erased the last number $(10)$ in the second round, then he erased $8$ The last remaining number in the circle is $4$ if $n=2016$ , what is the last remaining number in the circle? **My progress:** In the first round all the odd numbers will be erased $ n=1(\mod2) $ In the second round $ n=2(\mod4) $ will be erased, then $ n=4(\mod8) $.... but in the seventh round we have $ n=0(\mod128) $

Let it be that $a_{n}$ is the remaining number if we are dealing with the numbers $1,2,3,4,5\dots,n$.

If $n$ is sufficiently large then after erasing $1$ and leaving $2$ we have the numbers $3,4\dots,n,2$ ahead of us.

Comparing this with the situation in which we have the numbers $1,2,3,\dots,n-2,n-1$ ahead of us we conclude that $a_{n}=a_{n-1}+2$ if $a_{n-1}
Looking at sequence $\left(a_{n}\right)$ the following conjecture arises:

$$a_{n}=2n-2^{\lceil\log_{2}n\rceil}$$

This conjecture can be proved with induction and we conclude: $$a_{2016}=4032-2^{11}=1984$$

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 2340113dbd52846b257c5fdd2c229e2d