Does $2^n \bmod n$ ever repeat?
If the sequence be periodic, there should exist $M$ s.t. $\forall n,2^n\,mod\,n<M$.
Choose $k$ s.t. $2^k>M$. Choose big prime $p>2^k$.
Let $n=pk$ then $2^n\equiv 2^k$ mod $p$. Thus, $2^n\,mod\,n\ge 2^k$. (contradiction)
$a_n=0$ iff $n$ is a power of $2$. This is obviously not periodic.
It's easy to prove that $2^{3^n} \equiv 3^n-1 mod(3^n)$. So if you consider the sequence $x_{n}=(2^{3^n} \equiv 3^n-1 mod(3^n))$ it's divergent to infinity, and assumes infinite distinct values. So the sequence can't be periodic.