Multiplicative Dynamics

Set n to be the modulus. Set a to be some integer. This will make an arrow diagram picture of xax on the ring Z/nZ, 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.