Inductively, $a_n$ tells us the index of the ticket selected from the reordered stack $n, 1, 2, \ldots, (n-1)$ to determine $a_{n+1}$. So $$a_n = \begin{cases} 1 & \textrm{if } n = 1 \\ n-1 & \textrm{if }a_{n-1} = 1 \\ a_{n-1} - 1 & \textrm{otherwise} \end{cases}$$
Then $a_{2^n + k} = 2^n + 1 - k$ for $1 \le k \le 2^n$.