Additive 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$.  Then it will also make a dynamical portrait of the same map.

The next box plots the same function, but as a dynamical portrait.