The counter dial
0
0
0
1 / 5
A repeated reading does not mean the total stopped growing. The total always grows; only the reading wraps around.
In Lesson 01 the tip of the growing clock's hand travelled a total distance S(k) that keeps getting bigger. Now we attach a small counter dial with M marks. Every centimetre the tip travels moves the dial's pointer one mark, and after the last mark it rolls back to 0. The total grows forever, but the dial can only show M readings, so readings must repeat. You will find out how they repeat, work out the arithmetic of remainders, and prove exactly how long the pattern takes to start over.
Where this lesson is headed
In words: the dial reading is the remainder of the total distance after removing full trips around the dial, and the readings always repeat after at most 2M rotations. The dial is a separate choice: M does not have to equal the clock's starting circumference N.
N: starting circumference of the growing clock
g: how much the circumference grows after each rotation
k: rotations completed
T(k): 0 + 1 + ⋯ + (k − 1) = k(k − 1)/2, from Lesson 01
M: number of marks on the counter dial
R(k): the dial reading after k rotations
Start with the simplest clock from Lesson 01, N = 1 and g = 1, so the totals are 0, 1, 3, 6, 10, 15, …. Attach a dial with M = 5 marks. Turn the clock and watch where the pointer lands. Then change N, g or M: your rotation count stays put, so you can compare directly. The guided experiments below walk you through it. (Shortcut: Space turns one rotation, ← undoes one.)
A repeated reading does not mean the total stopped growing. The total always grows; only the reading wraps around.
Do these in order. Each one changes a single thing. "Set this up" puts the clock and dial in the right state; the dial and table update with it.
Each step has the general rule on the left and the same idea with actual numbers on the right. Steps 1 to 4 use your settings from Stage 01. Steps 5 and 6 look at one special dial and have their own inputs.
Any whole number S can be split into full trips of M plus a leftover smaller than M:
q counts the full trips and r is the dial reading. We write r = S mod M, and for our clock R(k) = S(k) mod M.
If a = qM + r and b = pM + r have the same reading r, then subtracting gives a − b = (q − p)M, a multiple of M. The reverse is also true: if a − b is a multiple of M, moving between them is whole trips around the dial, so they show the same mark. We write this
and say "a is congruent to b modulo M". Collisions are guaranteed: k = 0 to M gives M + 1 totals but the dial has only M marks, so at least two must share a mark.
Test any two numbers
If a ≡ a′ and b ≡ b′ (mod M), then
Why: (a + b) − (a′ + b′) = (a − a′) + (b − b′), and two multiples of M add to a multiple of M. Products work the same way, since ab − a′b′ = a(b − b′) + b′(a − a′).
For the clock this means the next reading only needs the current reading and the next rotation's distance:
Adding and multiplying are always safe. Cancelling a common factor is not:
What went wrong: "8 divides 2 × 4" only tells us 4 divides 4. The factor 2 shared with the modulus has to come off the modulus too. The rule, with d = gcd(c, M):
When gcd(c, M) = 1 you can cancel c and keep M.
Choose a dial with exactly as many marks as the starting circumference. The straight part of the total, k × N, is k full trips around that dial, so it disappears:
So on this dial only the growth part matters. This dial is the one used in later lessons.
Your special dial (its own settings)
Let d = gcd(g, N) and write g = d·u and N = d·m. Then u and m share no factor. Using step 2 and step 4:
So the scaled readings gT(k) mod N and the plain readings T(k) mod m collide at exactly the same k's. The labels differ, but the pattern of matches is identical. If g = 0 then d = N and m = 1, and everything is 0.
| k | T(k) | gT(k) mod N | T(k) mod m |
|---|
Having only M marks forces readings to repeat eventually, but it does not say when. The plan: compare the total after k + M rotations with the total after k rotations, and see what that difference does to the dial reading. The answer depends on whether M and g are even or odd.
Use T(k) = k(k − 1)/2 and expand both terms:
Subtract. The k² and −k cancel:
This is exact, not just a statement about remainders. M(M − 1)/2 is a whole number because one of M and M − 1 is even.
S(k) = kN + gT(k), so over M more rotations the straight part grows by MN and the growth part by g times step 1:
MN and gMk are multiples of M: whole trips, invisible on the dial. Only the last term can move the reading. Call its remainder the jump:
M odd. (M − 1)/2 is a whole number, so M(M − 1)/2 = M × (M − 1)/2 is a multiple of M. Jump = 0.
M even, say M = 2h. Then M(M − 1)/2 = h(2h − 1) = 2h·h − h = Mh − h. Taking away the whole trips Mh leaves −h, and −h + 2h = h, so this is h = M/2 on the dial. Multiplying by g: if g is even, g·h is a multiple of 2h = M, so jump = 0. If g is odd, jump = h = M/2.
Notice we never "divided by 2 modulo M". For even M that is exactly the careless cancellation from Stage 02, step 4.
| Case | Jump after M rotations | Guaranteed repeat |
|---|---|---|
| M odd | 0 | every M |
| M even, g even | 0 | every M |
| M even, g odd | M/2 | every 2M |
Jumping M rotations twice adds the jump twice. Either 0 + 0 = 0, or M/2 + M/2 = M, a full trip. Both are invisible on the dial:
So 2M rotations always bring the readings back, and M rotations already do when M is odd or g is even. These are guarantees; the pattern might repeat even sooner.
jump = 0 when M is odd or g is even; jump = M/2 when M is even and g is odd. So R(k + 2M) = R(k) always.
Complete proof
Let R(k) = S(k) mod M. Expanding gives
If M is odd, (M − 1)/2 is an integer, so every term is a multiple of M. If M = 2h, then M(M − 1)/2 = h(2h − 1) ≡ −h ≡ h (mod 2h). Multiplying by g gives gh ≡ 0 when g is even and gh ≡ h when g is odd. In all cases two successive jumps add 0 modulo M. Therefore R(k + 2M) = R(k) for every k ≥ 0. ∎