Consider the sequence defined by the following algorithm:
Make a stack of tickets numbered from 1 to $n,n>1 \in N$ and arranged in reverse order with the ticket numbered 1 at the bottom and that with $n$ at the top. Now apply the following repeatedly until we are left with only one ticket: Throw aside the top ticket and put the next ticket at the bottom. Define the number on the ticket so obtained at the end of the process as $a_n$.Also,define $a_1$ to be 1.
My question is:
Does the sequence $\langle a_n\rangle$ contain arbitrarily long monotonically increasing and arbitrarily long monotonically decreasing subsequences? Can we find a closed formula for $a_n?$
Mathematically I have absolutely no idea but the following plot for the first 20000 values makes me suspect it might be true.
On the x-axis is the value of $n$ and on the y -axis is the value of $a_n.$I will be highly obliged for any hints/suggestions