Multiplicative Dynamics

Set $n$ to be the modulus. Set $a$ to be some integer. This will make an arrow diagram picture of $x \mapsto ax$ on the ring $\mathbb{Z}/n\mathbb{Z}$, i.e. the elements modulo $n$.

The next box plots the same function, but as a dynamical portrait.  That means it will draw one vertex for each residue mod n and draw arrows for what the function does.