# Not-so-random walks

Back in December, I saw this post by John Golden, where he was exploring a visual representation of functions using modular arithmetic:

I was curious to look into this, so I set up the same thing using Desmos. It works as follows:

• Set n to be some positive integer (the base for the modular arithmetic).
• Divide the circle into n different directions, all equally spaced, numbered 1 to n anti-clockwise.
• Choose a function (odd powers generate particularly interesting patterns).
• Start at the origin. Then begin to draw a sequence of connected line segments of length 1 by using your function. For example, if you have chosen x³, your first line segment will be along direction 1³=1. At the end of this, you will draw another line segment along direction 2³=8, and you will continue in this fashion. If the output is larger than n, you will use its remainder when divided by n (i.e. for output y, use y mod n).

Click here to experiment with this yourself in Desmos.

I have documented some of the results for the function f(x)=x^5. Below you will find images for every integer value of n from 1 to 150, followed by a further selection up to n=400.

You will notice:

• The majority of the patterns form a continuous loop.
• Where there is not a continuous loop, the pattern repeats but is translated horizontally (what is special about these values of n?).
• Where there is a continuous loop, there is always at least one line of symmetry, but in some cases there are many more (which values of n give rise to high degrees of symmetry?).