Modular Arithmetic Dynamics Grapher
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$.
Press “Evaluate” to run.
Tips (if the picture isn’t pretty):
- Re-run the same code to see if it gets better at vertex placement (it is non-deterministic).
- Change the “vertex_size” in the last line if the labels are too big or small.
Note: you can also make additive dynamics by replacing R(a*l) with R(a+l) in line 9.