I stumbled across a cool problem presented by Cody Raskin. Here’s his post in full:

“Suppose you had a circle made of a hundred or so equidistant points on its circumference. If you drew straight lines connecting distant points on this circle (chords) in some systematic way, you’d produce a kind of spirograph. I don’t know what these plots are actually called, and “spirograph” is actually just the brand-name of a popular toy, but in any case, most people have probably drawn something like this at some point in their lives. The most common form of these that I’ve encountered are ones where the pattern for connecting the points is to simply connect every point `pi` to `pi + k` where `k` is some fixed offset. What if instead we connected `pi` to `pik` where `k` is now a fixed multiplier? I used the Desmos graphing calculator to play around with different values of `k` in real time. I did not expect the “lobe” count to scale as `∝ k−1`. I wonder if someone could come up with some hand-wavy argument as to why this behaves this way? In any case, you can try it out at Desmos here.”

If you haven’t clicked on the Desmos link yet, fiddle with it and see if you can get a sense for how it works!

I don’t recall ever drawing one of these when I was a kid. To make up for it, I’ve tried to reason through the question with the help of D3.js.

I am in no meaningful sense a mathematician. I imagine someone much more capable than I has long since given these constructions rigorous treatment (and I would love to know about it, if any experts happen by here).

We start at the beginning, which is also the end. Where’s that? The rightmost point on the graph: `p0` (that is, `pi` where `i = 0`). We increment `i` (the index of the current point) as we progress counter-clockwise around the perimeter of the circle. We calculate `j` (the index of the connected-to point) as a function of `i` and `k`.

The spirograph is `modular`, like a clock: `i` and `j` “wrap around” after some maximum value, back to `0`. In Cody’s graph that value is `500`, so we say we’re using arithmetic modulus `501`. This is equivalent, in this to context, to saying `n = 501`; that is, `0` and `501` are congruent, or interchangeable. So are `1` and `502`, `2` and `503`, and so on.

We can say such a congruence relation exists when (per Wikipedia):

`a` and `b` have the same remainder when divided by `n`.

It’s as if we’ve cut a slice (of length `n`) out of the number line, curled it into a loop, and glued the ends together. If you take `n` steps from `a` and call the place you arrive `b`, you’ll discover `b = a.`

Before the multiplier case, consider the offset, where each point `pi` connects to point `pj = i + k`. This produces some recognizable forms: the pentagram (`n = 5`, `k = 2`), for example.

The operative difference between offset and multiplier is the relationship between `i` and the minimum distance between `pi` and `pj` (as measured in either clockwise or counter-clockwise “hops” between adjacent points on the perimeter of the graph); let’s call this quantity `d`.

In the offset case `d = k` up to `i = n / 2`, then `d = n - k` up to `i = n`. If we plotted `d` as a function of `i` or `j`, we’d get a horizontal line.

What about the multiplier case, where `pi` connects to `pj = ik`? When (in standard arithmetic) `j ≥ n`, we substitute for `j` the congruent integer `c` such that `0 ≤ c < n`, given by `j mod n`.

When it comes time to connect `pi` to `pj`, we find ourselves back at the same point! These self-referential spots deserve a deeper look.

When does `j = i = i`? When `i = 0`, to begin with. Hence the first step in constructing any spirograph: just connect the initial point to itself. When else? When `j = ik = n`, since `pn = p0`.

After the initial self-connection step, each subsequent reflexive connection indicates that a cycle has been completed: that is, `pj` has “caught up to” `pi`. We’ll always find `k - 1` cycles because `pj` “travels” `k` times farther than `pi`, and “laps” it `k - 1` times. If we were to plot `d` for the multiplier case, we would get something like a sine wave taking domain `[0, n - 1]` to range `[0, n / 2]`.

Intuitively, lobe count scales at `∝ k - 1` because each densely-shaded cycle is a kind of “shadow” directly opposite a sparsely shaded “lobe”. “Shading” is sparser within each lobe and denser without because as you move away from a lobe center and nearer to a midpoint between lobes, each point’s outgoing connection line departs further from the tangent and approaches a clean bisection of the circle. There, `pi` is maximally distant from `pj`: `d = n / 2` (remainder `1` when `n` is odd). Outgoing connections swing back toward the tangent as you move toward the center of the next lobe. Dense shading occurs in small “shadows” near bisection initial points (opposite “lobes”) and forms lobe boundaries where chords “stack” tightly around the tangent line.

TL;DR: “Lobes” correspond to cycles in the spirograph. Each cycle is preceded by a bisection. Each bisection entails a small, densely-shaded “shadow” near its initial point, and a larger, sparsely-shaded “lobe” directly opposite (for small values of `k`, that is: patterns tend to recede into noise then re-emerge in more complex formulations as `k` increases).

Here’s a little animation of the multiplier case (which, when `k = 2`, yields the Rebel Alliance’s insignia). You can also increment or decrement `k`, then watch how many times the green dot (`pj`) “laps” the red one (`pi`).