Mod n can sound abstract: "a \equiv b \pmod n if n divides a - b." But picture it on a clock and every definition collapses into a single action. You walk around a circle with n positions and stop wherever your step count runs out. The position you stop at is a \bmod n. No division, no remainder computation — just walking.

This satellite lets you drag an integer, positive or negative, small or huge, and watch the pointer spin around a clock with n positions until it lands on exactly one of \{0, 1, 2, \dots, n-1\}. That landing position is the residue.

The mental model in one sentence

To compute a \bmod n, imagine walking a steps clockwise around an n-position clock starting from 0. Where you end is the answer.

That single sentence is all of residues. Negative a means walk counter-clockwise. The clock has no memory of how many full laps you made — only the final position matters. Two numbers that land on the same position are congruent mod n.

Drag the integer, watch the pointer

A mod-$n$ clock. Pick a modulus $n$ and an integer $a$; the pointer sweeps to position $a \bmod n$ along with a short animation showing each step. Try $a = 10, n = 7$: pointer lands on $3$ ($10 = 7 + 3$). Try $a = -4, n = 7$: pointer lands on $3$ (four steps counter-clockwise = three steps clockwise). Try $a = 100, n = 7$: pointer on $2$, with $14$ full laps.

What the visualisation reveals

Every integer lands somewhere. No matter how large or small, positive or negative, the pointer lands on exactly one of \{0, 1, 2, 3, 4, 5, 6\}. Those seven positions are the residue classes modulo 7, and they partition the integers into seven disjoint stripes.

Huge integers take shortcuts. For a = 100 the pointer does not spin around fourteen times — it just knows where it ends. The fourteen laps are wasted motion. This is why you always reduce first, then compute: the laps do not matter, only the final landing does.

Negatives wrap the other way. For a = -3, the pointer goes counter-clockwise three steps and lands at position 4. That is because -3 = 7 \times (-1) + 4 — a "lap backwards" landing at 4. Negative residues are fine; you just pick the representative between 0 and 6.

Same landing = congruent. If you drag to a = 3 and then to a = 10, the pointer lands on the same spot. That is the visual meaning of 3 \equiv 10 \pmod 7. The congruence symbol \equiv is saying "lands at the same position."

Why laps do not matter: adding n to any integer takes the pointer one full lap around the clock, returning to the same spot. So a and a + n and a + 2n and a - n all land identically. The set of integers that land at position r is \{\dots, r - 2n, r - n, r, r + n, r + 2n, \dots\} — and that set is exactly one residue class.

From clock to formula

The arithmetic identity behind every clock walk is the division algorithm:

a = q \cdot n + r, \qquad 0 \le r < n

Here q is the number of full laps (possibly negative) and r is the landing position. The visualisation animates both numbers at once: the "full laps" readout is q, and the pointer shows r.

When a = 100 and n = 7, the machine picks q = 14 and r = 2. When a = -4 and n = 7, it picks q = -1 and r = 3 (not q = 0 and r = -4 — the convention is that the remainder must be non-negative, so one lap gets borrowed from the quotient).

Try these in the widget

Once you have watched a dozen integers land, the picture of residue classes as "stripes on the number line that all land on the same clock position" becomes permanent. You never again think of "mod" as a division operation — you think of it as a landing address.

One worked example

What is $(-50) \bmod 7$?

Instead of computing remainders directly, imagine the clock. Starting at 0, walk 50 steps counter-clockwise.

Step 1. Figure out how many full laps fit in 50 backwards steps. 50 = 7 \times 7 + 1, so 7 full laps backwards use up 49 of the 50 steps, leaving one extra step counter-clockwise.

Step 2. One step counter-clockwise from 0 lands at position 6 (just before 0, going backwards).

So (-50) \bmod 7 = 6.

Why: in the clock picture, position 6 is the same as "one step back from 0." Algebraically, -50 = 7 \cdot (-8) + 6 — eight laps backwards brought you to -56, and then walking forward 6 brings you to -50. The clock takes care of the arithmetic automatically.

Drag the slider to -50 in the widget and confirm: the pointer lands on 6.

Why this is the right mental model

Two facts about modular arithmetic follow immediately from the clock picture, with no formal proof needed.

  1. a \equiv b \pmod n if and only if a and b land on the same clock position. This is the definition in geometric form, and it makes reflexivity, symmetry, and transitivity of congruence obvious (a clock position equals itself; if two things land at the same spot then the spots match; if three things all land at the same spot, the first and third do too).

  2. Only n residues exist. The clock has n positions — period. Every integer lands on one of them. This is why modular arithmetic is a finite system even though the integers are infinite.

Once you carry the clock mental image, problems like "what is 3^{100} \bmod 7?" stop looking like number crunching and start looking like "where does the pointer land after taking a specific number of steps?" The computation simplifies because you never step further than one lap.

Related: Modular Arithmetic · Number Line Wrapping into a Circle · Residue Classes as Colour Bands · Chinese Remainder Theorem — Two Clocks · Number Theory Basics