Skip to content

The big questions

Modulo

Modulo explained simply: what it keeps, what it throws away

The short answer

Modulo keeps the remainder of a division and throws away the number of turns. On a clock, 3 p.m. and 3 a.m. land on the same spot: the hand says where you are in the turn, not how many turns have gone by. That is very useful, and it becomes dangerous as soon as the remainder is taken for the whole number.

Modulo is a clock

FactA clock counts from 1 to 12, then starts again. At 15:00 the hand points to 3. Mathematicians write: 15 modulo 12 equals 3. One turn of 12 has been removed, and what is left over has been kept.

FactThe odometer of an old car does the same thing. It has six digits: after 999,999 kilometres it shows 000,000. The car is not new. The counter has made one full turn, and that turn is written nowhere.

So modulo is not a calculation error. It answers one precise question correctly: where are we in the turn? It does not answer the other question: how many turns have we made?

What it keeps, what it throws away

TheoremEvery whole number can be written in exactly one way as some turns of 9, plus a position. For example 19 = 2 turns of 9, plus 1. And 28 = 3 turns of 9, plus 1. The ARC corpus counts positions from 1 to 9: 18 is one turn, and position 9.

Theorem10, 19, 28 and 1,000,000 all have the same position: 1. If only the position is kept, these four numbers become the same one. And there is no way back: from "position 1", nobody can tell which number you started from.

TheoremThe loss can be measured. Among the first million numbers, 111,112 have position 1. Saying only "position 1" therefore leaves 111,112 candidates. Counting information the way engineers do (in bits), the position among nine keeps 3.17 bits out of 19.93: 84% of what the number carried is thrown away.

When the position is enough, and when it is not

TheoremThe position is enough for some questions. A number is divisible by 3 exactly when its position is 3, 6 or 9: the turns are not needed.

TheoremIt is not enough for others. 10 and 19 have the same position: one is even, the other odd. 19 and 28 have the same position: one is prime, the other is not. Whenever the answer depends on the turn, modulo cannot give it.

When the remainder was taken for the number

FactIn a computer, a counter has a fixed number of digits. When it is full it rolls back to zero, like the car odometer. If the program believes that zero is the real number, it is wrong.

FactIt has happened. In 1987, in the Therac-25 radiotherapy machine, a counter that rolled back to zero on its 256th pass caused a safety check to be skipped, and a patient died of an overdose. In 2015 the authorities required Boeing 787s to be restarted before a counter reached its end, at 248 days. In 1999 and in 2019 GPS receivers believed they were twenty years in the past. The Boeing case, with its calculation.

The ARC reading

ReadingThe corpus does not blame modulo for calculating badly. It blames what was done with it: taking the position for the number, and forgetting that the turns existed. It dates that gesture to Gauss, in 1801, when 9 was written as 0: the end of the turn confused with emptiness.

TheoremKeeping the turns is keeping everything. If you write down the position, then the position of the number of turns, and so on, you recover the whole number with nothing lost. 2026 is written 2, 6, 9, 1, because 2 × 729 + 6 × 81 + 9 × 9 + 1 = 2026.

Reading"It is the tool that is judged, not those who used it."

What this page does not claim

It does not say that modulo is wrong or should be abandoned. Where losing is the goal, it is in its place: the encryption that protects a password or a payment relies precisely on a way back that has been thrown away.

It does not blame modulo for everything. The Patriot missile of 1991 drifted because of a truncated decimal, not a remainder: that is a different gesture, and the corpus keeps them apart.

Further reading

Related questions

Every statement carries its status: Fact (what science holds), Theorem (verified computation), Reading (the corpus's interpretation), Prediction (what would bring it down).
Filipe Bastos · ARC Corpus · CC BY 4.0 · Reading method: fractal, social and relational empathy · Found an error? Send a contradiction