Count up to sets how many integers a run places, from 1 up to the cap printed under the box as max for divisor n; a larger value shows a red message and disables ā¶ Run. Learn more about the count
The Divisor grid picks n from 2 to 9; the wheel is re-divided into n slices at once and any run is cleared. Learn more about the divisor grid
The Speed slider, from š¢ to š, sets the time per number, about 365 ms at 1 and 50 ms at 10; a run keeps the speed it started with. Learn more about the speed slider
ⶠRun places 1,2,3,⦠one per tick and turns into ⹠Stop, which halts the run; Reset clears the wheel and any pinned class. Learn more about the run controls
The wheel has one slice per remainder, 0 starred at the top and the rest clockwise; rows fill outward from the centre, and the hub reads mod n. Learn more about the wheel and slices
Hover or tap a slice to see its class: a tooltip gives the formula and examples, the right panel lists the numbers placed there, and a tap pins it until you tap again. Learn more about hovering and pinning
The right panel switches between Overview, Now placing, Class details and Run complete, which lists the divisible numbers and the count per class. Learn more about the right panel
Modular arithmetic ā arithmetic on remainders. Given a divisor (or modulus) n, every integer is replaced by its remainder when divided by n, an integer in the range {0,1,ā¦,nā1}.
Modulus / divisorn ā the integer you divide by. On this tool, n ranges from 2 to 9 (the slice count).
Remainder ā the leftover after integer division. For a=qn+r with 0ā¤r<n, the remainder is r, written amodn=r.
Congruenceaā”b(modn) ā read ais congruent tobmodulon. True when a and b leave the same remainder when divided by n, equivalently when n divides aāb.
Equivalence class / residue class ā the set of all integers sharing the same remainder. There are exactly n classes mod n, labeled [0],[1],ā¦,[nā1].
Zero class (principal class) ā the class [0], containing 0 and all multiples of n. It's the identity element of the ring Z/nZ and corresponds to the principal ideal nZ. The tool highlights this class with a gold star and warm color.
Z/nZ ā the integers mod n, the set of n equivalence classes with addition and multiplication inherited from Z.
Getting Started
The tool opens with divisor n=6 and a count target of 36. The scene splits into three areas:
⢠A control panel on the left with inputs for the count target, the divisor (a button grid for n=2 through 9), a speed slider, and Run / Stop / Reset buttons.
⢠A circular wheel in the middle, divided into n equal slices. Each slice is one remainder class. The zero class sits at the top (12 o'clock) marked with a gold star ā .
⢠A context panel on the right that switches modes depending on what's happening: an overview before running, a now placing log while running, a class details card when you hover or pin a slice, and a run complete summary at the end.
To run:
⢠Set the count target ā the number of integers to sort (1 through that target).
⢠Pick a divisor in the grid.
⢠Press ā¶ Run ā numbers 1,2,3,⦠appear one at a time, each placed in its remainder slice with rows filling outward from the center.
⢠Hover or click a slice to see its formula, examples, and any numbers already placed there.
⢠Reset to clear and try a different combination.
mod 6, idle, frozen
Six empty slices around the mod 6 hub, the zero class starred at twelve oāclock. Nothing is placed yet ā the wheel is pure structure.
The frozen frame above is the idle wheel: six empty slices around the mod 6 hub, structure without content. Even empty, it already says something ā the modulus alone fixes how many classes exist, before a single number is sorted.
Idle is also the state to read the geometry in: slice labels outside, row arcs faint inside, and the starred zero slice at twelve o'clock. Once Run is pressed, the wheel anatomy fills in exactly these positions.
The Wheel and Slices
The wheel divides a circle into n equal slices, one per remainder class. Five things to watch:
⢠Slice labels outside each slice show the remainder value: 0 at the top, then 1,2,ā¦,nā1 going clockwise.
⢠Slice colors use a blue palette so the zero class can stand apart. The zero slice has a warmer fill and a thin gold accent arc along its outer edge.
⢠Rows within each slice run from the center outward ā row 1 is closest to the center, row 2 above it, and so on. Each row holds the next occurrence of that class.
⢠Numbers in cells are drawn rotated so they always read upright relative to the slice they sit in. A label like *36* in slice 0 row 6 tells you 36=6ā 6+0, the sixth multiple of 6.
⢠Center label shows modn ā the modulus currently in effect.
Cells are placed in real time as the run progresses. The geometry adapts to the available width: bigger screens get a larger wheel with taller rows; smaller screens compress the row height. The control panel shows a max-count cap for the current divisor ā going beyond it would make labels unreadable.
Run Controls and Speed
DemoRun, Stop, Speed and Reset
Step 0 of 4
The control panel offers three transport actions and a speed slider:
⢠ⶠRun ā starts placing numbers from 1 up to the count target, one per tick. Disabled while the input is invalid (empty, non-numeric, below 1, or above the geometric max).
⢠⹠Stop ā halts placement at the current number. The wheel keeps what's there; press Run again to start fresh from 1.
⢠Reset ā clears all placed cells, unpins any class, and restores the idle state.
⢠Speed slider with tortoise š¢ and hare š markers controls the tick delay. The tick interval is roughly max(20,400ā35ā speed) milliseconds ā at speed 1 each number takes about 365 ms; at speed 10 each takes about 50 ms.
While running, the right panel switches into now placing mode (the right panel) and shows live arithmetic for the most recent number: nĆ·d=q remainder r, and which slice and row it just landed in. Numbers in the zero class get extra emphasis to call out the divisibility.
mod 6, placing 17, frozen
Seventeen numbers in: 17 Ć· 6 = 2 remainder 5, so 17 has just landed in class 5, row 3 ā the third number to leave that remainder.
The frozen frame above catches a run mid-flight: seventeen numbers placed, and the log reporting 17Ć·6=2 remainder 5 ā so 17 has just landed in class 5, row 3. Rows count occurrences: 17 is the third number (after 5 and 11) to leave remainder 5.
Watching a few ticks makes the rhythm obvious: the placement simply walks around the wheel, one slice clockwise per number, wrapping back to the starred slice at every multiple. That steady rotation is the additive structure of equivalence classes in motion.
Hovering and Pinning Classes
DemoPinning a class
Step 0 of 4
Every slice on the wheel is interactive:
⢠Hover any slice ā a floating tooltip appears showing the class title, formula, description, and example numbers. The right panel simultaneously switches into class details mode with the same information plus the list of numbers already placed in that class.
⢠Click to pin the class ā the tooltip stays put, the slice darkens slightly, and the right panel keeps showing details until you click somewhere else (or click the same slice again to unpin).
⢠Click anywhere outside any slice to clear the pin.
The tooltip layout adapts to viewport edges ā it flips to the left of the cursor when too close to the right edge and above when too close to the bottom. Pinned tooltips show a *š Pinned* indicator at the bottom; hover-only tooltips show Tap to pin.
The class details panel includes:
⢠The formula ā n=nk for class 0, or n=nk+r for class r.
⢠A Placed so far block listing every number from the current run that landed in this class, if any.
mod 6, class 2 pinned, frozen
The darkened slice collects 2, 8, 14, 20, 26, 32 ā every number of the form 6k + 2, each exactly six apart.
The frozen frame above has class 2 pinned after a full run of 36: the darkened slice holds 2, 8, 14, 20, 26, 32 ā six numbers, each exactly six apart. Pinning turns one wedge of the wheel into a statement: this is a single residue class, an arithmetic progression wrapped into a slice.
Pinning is also the way to compare classes: pin one, read its members, then pin its neighbor and watch every number shift by exactly one. The only slice that answers differently is the starred one ā see the zero class.
The Zero Class ā Why It's Special
Class [0] ā the multiples of n ā gets special visual treatment: it's centered at 12 o'clock, marked with a gold star ā , outlined with a warm-gold accent arc, and labeled prominently in the legend.
The emphasis is mathematical, not cosmetic. The zero class is the principal class:
⢠It contains the integer 0, which is the additive identity of Z/nZ.
⢠It's the only class where divisibility byn is true ā every member is an exact multiple of n.
⢠Every other class is the zero class shifted: class [r]=[0]+r.
⢠In ring theory it corresponds to the principal idealnZ.
⢠It's the kernel of the canonical map ZāZ/nZ ā the integers that get sent to 0 under modular reduction.
For applications, the zero class is what you test for divisibility, what triggers modular conditions like check ifnis a multiple of7, and what determines whether a number has a multiplicative inverse in Z/nZ (nonzero residues coprime to n do; zero never does).
mod 6, zero class pinned, frozen
The gold-edged slice holds 6, 12, 18, 24, 30, 36 ā the multiples of 6, the only class where divisibility is true.
The frozen frame above has the principal class pinned after a full run: 6, 12, 18, 24, 30, 36 sit in the gold-edged slice ā the multiples of 6, and nothing else. Every divisibility question about 6 is a question about membership in this one slice.
The gold styling repays attention during a run, too: each time the placement crosses twelve o'clock, the number landing there is exactly a multiple of the modulus, and the now placing log flags it. Divisibility stops being a property you compute and becomes a place on the wheel.
Adjusting Divisor and Count
DemoDivisor and count
Step 0 of 5
Two inputs control the size and shape of the wheel:
⢠Count up to sets the upper bound of the integers placed during a run. Range starts at 1 and is capped per divisor by a geometric maximum ā the cap ensures rows fit at the minimum readable cell height. The cap appears below the input as max for divisorn: M. Common caps at default width: divisor 2 allows roughly 80 numbers, divisor 9 allows much more since rows are spread across more slices.
⢠Divisor (number of slices) is an eight-button grid for n=2,3,4,5,6,7,8,9. Picking a new divisor immediately clears any in-progress run and re-divides the wheel. The wheel resizes and re-labels each slice.
Try these comparisons:
⢠Divisor2 ā split into even and odd halves. Class 0 = evens, class 1 = odds.
⢠Divisor5 ā slice r holds every integer whose last digit is r or r+5. The closest this wheel gets to reading off last digits directly (a mod-10 wheel would do it exactly, but the divisor grid stops at 9).
⢠Divisor7 ā counting from 1 takes seven numbers to complete one row across all slices. Mimics the day-of-week shift.
⢠Same number, different divisors ā keep the count fixed at 30 and step through divisors 2 to 9 to see how class sizes change.
mod 2, 20 placed, frozen
Two half-circles: evens in the starred half, odds opposite, ten each. Parity is the smallest modulus, drawn as a coin with two faces.
The frozen frame above is the divisor-2 wheel after counting to 20: two half-circles, evens in the starred half, odds opposite, ten numbers each. Parity ā the oldest classification in arithmetic ā is just modular arithmetic at its smallest modulus, and the wheel draws it as a coin with two faces.
Changing the divisor is the tool's most instructive move: the same integers exist either way, but the wheel repartitions them completely. Nothing about a number changes; only the question asked of it does. How the classes balance out at the end of a run is taken up under reading a complete run.
Right Panel Context
The right panel adapts to whichever phase the visualization is in:
⢠Overview (idle) ā appears before the first run. Confirms which divisor is selected and prompts you to press Run.
⢠Now placing (running) ā shows the most recent number, its division arithmetic (nĆ·d=q remainder r), which class it landed in, and which row within that class. Zero-class hits get a divisible byn accent.
⢠Class details (hover/pin) ā appears whenever a slice is hovered or pinned. Shows the formula, first eight examples, and any run-placed numbers in this class.
⢠Run complete (summary) ā appears after the count target is reached. Lists the divisible numbers in the zero class as the headline, then a grid showing the count per class.
Below the adaptive box sits a static deep-dive section with five collapsible-looking subsections: What is modular arithmetic, Equivalence classes, *The zero class ā why it's special*, How to read this wheel, and Try this. These are always available and don't change with state ā they're reference material to read alongside experimenting on the wheel.
Reading a Complete Run
DemoReading a complete run
Step 0 of 4
When the last number lands, the right panel switches to its run complete summary: the divisible numbers ā the contents of the zero class ā as the headline, then a small grid counting the members of every class.
For the default run of 36 with divisor 6, the wheel finishes perfectly balanced: six full rows in every slice, exactly six numbers per class. That is no accident ā 36 is a multiple of 6, so the count 1 through 36 completes whole laps of the wheel.
The counts can never be lopsided by much. Counting 1 through N deals numbers to the slices in strict rotation, so any two classes differ by at most one member.
mod 6, run complete, frozen
All 36 numbers placed: six full rows in every slice, six per class ā perfectly balanced, because 36 is a multiple of 6.
The near-balance has a precise form. Write N=qn+r; then classes 1 through r hold q+1 numbers and the rest hold q. Try counting to 20 with divisor 6: classes 1 and 2 collect four members, every other class three ā and the zero class gets exactly ā20/6ā=3, namely 6, 12, 18.
This is the pigeonhole picture of equivalence classes: n boxes, dealt in rotation, can never be unfair by more than a single card. Change the divisor and rerun to watch the same fairness reassert itself over different slices.
What Is Modular Arithmetic
Modular arithmetic replaces each integer with its remainder when divided by a fixed modulus n. The result is always one of {0,1,ā¦,nā1}, no matter how big the input.
The fundamental notation is congruence:
aā”b(modn)āŗnā£(aāb)
That is, a and b are congruent modulon when their difference is a multiple of n, equivalently when they leave the same remainder.
Examples:
⢠Clock arithmetic is mod 12 (or mod 24). 14 o'clock ā”2 o'clock (mod12).
⢠Days of the week are mod 7. If today is Wednesday, day 100 from now is Wednesday +100mod7= Wednesday +2 = Friday.
⢠Parity is mod 2. Even means ā”0(mod2); odd means ā”1(mod2).
⢠Cryptography ā RSA, Diffie-Hellman, elliptic-curve protocols all operate in Z/pZ or Z/nZ for very large n.
⢠Hashing and indexing ā converting arbitrary integers into a fixed range {0,ā¦,nā1} is exactly modular reduction.
The operations of addition, subtraction, and multiplication on classes are well-defined: (a+b)modn=((amodn)+(bmodn))modn, and likewise for multiplication. Division (modular inverse) exists only when gcd(a,n)=1.
For deeper coverage, see the modular arithmetic section on the number theory page.
Equivalence Classes and Their Structure
For a fixed modulus n, the integers Z split into exactly n disjoint equivalence classes:
Z=[0]ā[1]āāÆā[nā1]
The square cup ā is a union carrying a promise: it is written in place of āŖ precisely when the pieces are known to be disjoint, so the line asserts both that the classes cover Z and that they never overlap. Ordinary āŖ would be equally true here and would say less.
Each class [r] is the set {r+kn:kāZ} ā an infinite arithmetic progression spaced n apart on the number line.
Properties:
⢠Every integer belongs to exactly one class.
⢠Two integers are in the same class iff they're congruent mod n.
⢠Class [r] contains negative numbers too: ā7ā”5(mod12) because ā7+12=5.
⢠Class sizes are infinite in Z; on the wheel they look finite only because we cut the count at the target.
The set of classes is a ring. Define [a]+[b]=[a+b] and [a]ā [b]=[aā b] on representatives, then check the result doesn't depend on which representatives you picked. The result is the ring Z/nZ:
⢠Always associative, commutative, with multiplicative identity [1].
⢠A field exactly when n is prime ā then every nonzero class has a multiplicative inverse.
⢠When n is composite, some classes are zero divisors: nonzero [a],[b] with [a]ā [b]=[0]. For instance, in Z/6Z, [2]ā [3]=[6]=[0].
The wheel visualizes the additive structure: shifting all numbers by +1 rotates everything one slice clockwise. Multiplicative structure is harder to picture but underlies most applications.
Related Concepts
Greatest common divisor (gcd) ā closely tied to modular arithmetic. The Euclidean algorithm computes gcd(a,b) using repeated modular reduction. An integer a has a multiplicative inverse mod n iff gcd(a,n)=1.
Euler's totientĻ(n) ā counts integers in {1,ā¦,nā1} that are coprime to n. Equivalently, the number of invertible classes in Z/nZ. For prime n, Ļ(n)=nā1.
Fermat's little theorem ā for prime p and a coprime to p: apā1ā”1(modp). Generalizes to Euler's theorem aĻ(n)ā”1(modn).
Chinese Remainder Theorem ā if gcd(m,n)=1, the system xā”a(modm) and xā”b(modn) has a unique solution mod mn. Lets you reconstruct an integer from its residues in different moduli.
Modular exponentiation ā computing akmodn efficiently via repeated squaring. The core operation in RSA.
Discrete logarithm ā given g,h,n, find k with gkā”h(modn). Hard in general; security of Diffie-Hellman depends on it.
Quadratic residues ā integers that are squares mod n. Class [r] is a quadratic residue mod n if there exists x with x2ā”r(modn).
Congruence equations ā solving axā”b(modn). Has a solution iff gcd(a,n) divides b.
Modulo calculator ā to compute amodn for arbitrary integers, see the modulo calculator.
Base Converter ā the units digit of N in base b is Nmodb, the position N lands on around a wheel of b slots.
Divisibility Table ā the divisibility rules are the statement that a number lands on position 0 of the wheel.
Divisibility Tiles ā a remainder drawn as the tiles left over after filling complete rows.