Consider the sequence $2,2^2,2^3,2^4,...$
(a) Show that the sequence is eventually periodic modulo $n$ and the period is less than $n$.
(b) Determine all positive integers $n$ for which the sequence is completely periodic modulo $n$.
Progress so far:
(a) Suppose the period is $k$, then we have $2^j \equiv 2^{j+k} \mod n$, where we assume that $n$ does not divide $2^j$. Then we have $n$ divides $2^j(2^k -1)$ which implies $n$ divides $2^k -1$.
(b) For all odd primes $n$ I think the sequence is completely periodic modulo $n$.
I am stuck with the problem. Need some hints to proceed.
If $f$ is moreover a bijection, then $x,\ f(x),\ f^{2}(x),\ \dots$ is already periodic from the outset.
(The superscripts of $f$ denote iterated composition.)
– Rafi Apr 13 '23 at 22:45