Here’s a Sage cell for experimenting with powers in modular arithmetic. It creates a plot of $a^i$ modulo $n$ as $i$ ranges from $0$ to $n-1$. You’ll notice some patterns:
- if the order of $a$ is small, you’ll see the plot repeat
- even if the order of $a$ is $n-1$ (say, $n$ is prime and $a$ has full order), you’ll see one symmetry that has to do with $-1$ (flip and rotate)
Do you notice anything else?