A logbook for curious waters
← All Reckonings

The Daily Reckoning

How Can 7²²² Fit on a Clock?

Modular arithmetic discards whole laps, turning a 188-digit power into a four-step cycle.

Arithmetic Behind Secure Messages · Part 1 of 3

Difficulty
Foundational
Area
Numbers and algebra
Reading time
9 minutes
Prerequisites
Whole-number division with remainders · Exponents · Factors and multiples
A neon ten-position remainder dial floats over a dark maritime drafting grid, with bright paths connecting the repeating power residues 1, 7, 9, and 3.

The number 72227^{222} has 188 decimal digits. Writing all of them would answer many questions nobody asked. Suppose we want only the final digit.

A final digit is a remainder after division by 1010. The numbers 77, 1717, and 2,8472{,}847 all leave remainder 77 when divided by 1010, so they are interchangeable for this particular question. Modular arithmetic turns that deliberate loss of information into a system of calculation.

The answer to our enormous-looking problem is 99. We can reach it without ever handling a number larger than 6363.

When numbers differ by a whole number of laps

Imagine ten marked positions arranged in a circle: 0,1,2,…,90,1,2,\ldots,9. Moving forward 1717 positions ends at 77 because the first 1010 moves complete a lap. Moving forward 2,8472{,}847 positions ends there too. Modular arithmetic forgets the completed laps and remembers the landing position.

Here is the precise definition. Let aa and bb be integers, and let nn be a positive integer. We write

a≡b(modn)a\equiv b\pmod n

and say “aa is congruent to bb modulo nn” when nn divides a−ba-b. The statement “nn divides a−ba-b” means that a−ba-b equals nn times some integer. Equivalently, aa and bb leave the same remainder when divided by nn.

For example,

37≡7(mod10)37\equiv7\pmod{10}

because 37−7=3037-7=30, and 3030 is divisible by 1010. Congruence is not equality: 3737 and 77 are different integers. They occupy the same position on a ten-position remainder clock.

The interactive diagram below uses modulus 1010, so each highlighted position is a possible final digit. Choose a base, then move the exponent slider. The glowing path records each remainder produced by another multiplication.

Interactive remainder clock

Watch powers wrap around ten possible endings

Choose a base
Powers of 7 modulo 10 through exponent 6The residues follow the path 1, 7, 9, 3, 1, 7, 9. The path returns to 1 after four multiplications, then repeats.0123456789
7^6 ≡ 9 (mod 10)
Current remainder
9
Repeating cycle
1 → 7 → 9 → 3

Powers visited

  1. 701
  2. 717
  3. 729
  4. 733
  5. 741
  6. 757
  7. 769
What to notice: multiplication does not move outward toward ever larger integers. Every step lands on one of ten residue positions. For base 7, the path cycles through 1, 7, 9, and 3, so exponents that differ by 4 land on the same position.

Why throwing information away is safe

Replacing 3737 by 77 would ruin a calculation that needs the full value. It preserves any calculation that asks only for a remainder modulo 1010.

More generally, suppose

a≡b(modn)andc≡d(modn),a\equiv b\pmod n \qquad\text{and}\qquad c\equiv d\pmod n,

where a,b,c,a,b,c, and dd are integers and nn is a positive integer. We may add or multiply the shorter representatives:

a+c≡b+d(modn)a+c\equiv b+d\pmod n

and

ac≡bd(modn).ac\equiv bd\pmod n.

The addition rule works because

(a+c)−(b+d)=(a−b)+(c−d).(a+c)-(b+d)=(a-b)+(c-d).

Both differences on the right are multiples of nn, so their sum is a multiple of nn. For multiplication,

ac−bd=a(c−d)+d(a−b).ac-bd=a(c-d)+d(a-b).

Again, each term on the right contains a multiple of nn. This permission to reduce after every step prevents powers from becoming unmanageable.

Worked example: the last digit of 72227^{222}

Start multiplying by 77, keeping only each remainder modulo 1010:

71≡7(mod10),72=49≡9(mod10),73≡9⋅7=63≡3(mod10),74≡3⋅7=21≡1(mod10).\begin{aligned} 7^1&\equiv7\pmod{10},\\ 7^2&=49\equiv9\pmod{10},\\ 7^3&\equiv9\cdot7=63\equiv3\pmod{10},\\ 7^4&\equiv3\cdot7=21\equiv1\pmod{10}. \end{aligned}

The fourth power returns to remainder 11. Multiplying by 77 once more must return to remainder 77, then to 99, then to 33, then to 11. The four-position cycle repeats because the next landing position depends only on the current remainder.

Now divide the exponent 222222 by the cycle length 44:

222=4⋅55+2.222=4\cdot55+2.

The exponent contains 5555 complete four-step cycles and two additional steps. Algebra says the same thing:

7222=74⋅55+2=(74)5572≡155⋅9(mod10)≡9(mod10).\begin{aligned} 7^{222} &=7^{4\cdot55+2}\\ &=(7^4)^{55}7^2\\ &\equiv1^{55}\cdot9\pmod{10}\\ &\equiv9\pmod{10}. \end{aligned}

Therefore the final digit of 72227^{222} is 99. The other 187 digits never enter the calculation.

Try two clocks

Problem 1

One hundred days after a Wednesday, what day of the week will it be? Treat Wednesday as the starting day rather than day one.

Reveal the solution

Days of the week repeat modulo 77. Divide 100100 by 77:

100=7⋅14+2,100=7\cdot14+2,

so

100≡2(mod7).100\equiv2\pmod7.

Move two weekdays forward from Wednesday: Thursday is one step and Friday is two. The date will fall on Friday.

Problem 2

Find the final two digits of 3203^{20}. A pair such as 0101 counts as two digits.

Reveal the solution

Final two digits are determined by the remainder modulo 100100. Repeated squaring keeps every intermediate value small:

35=243≡43(mod100).3^5=243\equiv43\pmod{100}.

Square that remainder to reach the tenth power:

310≡432=1849≡49(mod100).3^{10}\equiv43^2=1849\equiv49\pmod{100}.

Square once more:

320≡492=2401≡1(mod100).3^{20}\equiv49^2=2401\equiv1\pmod{100}.

The remainder is 11, so the final two digits are 01.

Remainders before the symbol ≡\equiv

People calculated with remainders long before anyone wrote the congruence symbol. A Chinese mathematical text known as the Sunzi Suanjing asks for an unknown number of objects that leaves 22 when counted by threes, 33 when counted by fives, and 22 when counted by sevens. The smallest answer is 2323. The text gives a working method for such problems, the earliest surviving example of what Europeans later named the Chinese remainder theorem.

The author and date of the Sunzi Suanjing are not securely known. Historians place its composition or compilation roughly between the third and fifth centuries CE, and surviving editions may contain layers from different periods. That uncertainty matters: “Sunzi” does not identify a documented lone discoverer in the modern biographical sense. Shen Kangsheng’s historical study of the Chinese remainder theorem connects congruence problems in ancient China to calendar calculation, where several astronomical cycles had to be reconciled.

Indian mathematician and astronomer Aryabhata developed another remainder-based procedure called the kuṭṭaka, or “pulverizer.” His Aryabhatiya, completed in 499, used the procedure to solve integer equations arising from planetary periods. Aryabhata worked at Kusumapura when the city was a capital of the Gupta Empire and a center in a communications network through which mathematical and astronomical work circulated across India and later into the Islamic world. The University of St Andrews biography of Aryabhata documents both the astronomical motivation and that institutional setting.

Carl Friedrich Gauss supplied the notation used today. His 1801 Disquisitiones Arithmeticae begins by defining congruent numbers and introduces ≡\equiv to emphasize an analogy with equality. Gauss did not invent division with remainders. He gathered results by earlier mathematicians, added major results of his own, and made congruence the organizing language of a systematic number theory.

That reorganization depended partly on patronage. A stipend from the Duke of Brunswick-Wolfenbüttel allowed Gauss to attend the Collegium Carolinum and later to pursue research without taking a job; the duke continued the support while Gauss prepared his doctorate and book. The MacTutor account of Gauss’s education makes the material condition unusually visible: the mathematics that now feels elementary reached print because a talented young scholar had sustained institutional funding.

What a remainder can carry

Schedules. Weekdays use modulus 77; a 24-hour clock uses modulus 2424. Gear teeth, rotating encoders, repeating shifts, and circular buffers share the same structure. A remainder records position inside a cycle while discarding completed cycles.

Error detection. An International Standard Book Number with ten characters, known as an ISBN-10, chooses its final character so a weighted sum is divisible by 1111. For the valid ISBN 00-306306-4061540615-22,

10(0)+9(3)+8(0)+7(6)+6(4)+5(0)+4(6)+3(1)+2(5)+1(2)=132,10(0)+9(3)+8(0)+7(6)+6(4)+5(0)+4(6)+3(1)+2(5)+1(2)=132,

and 132≡0(mod11)132\equiv0\pmod{11}. Changing any one digit changes the remainder, so the check fails. The check character can be XX, representing 1010, because modulus 1111 has eleven possible residues.

Public-key cryptography. Modern cryptographic standards repeatedly raise large integers to powers and reduce the results modulo another large integer. The Internet Engineering Task Force’s RSA specification, RFC 8017, for example, defines its core encryption operation by c=me mod nc=m^e\bmod n, where mm represents a message, ee is a public exponent, nn is a public modulus, and cc is the encrypted representative. Modular arithmetic alone does not make RSA secure; the choice of nn, the relation between public and private exponents, padding, and implementation details all matter. The next two lessons in this mini-series will build those missing pieces.

One idea to remember

Modular arithmetic keeps the landing position and discards whole laps. Once 747^4 returns to 11 modulo 1010, every four additional factors of 77 repeat the same final-digit pattern. For 72227^{222}, only the remainder of 222222 after division by 44 matters.

For another appearance of remainder arithmetic, revisit Euler’s bridge test: classifying a vertex degree as odd or even means recording that degree modulo 22. Part two of Arithmetic Behind Secure Messages will explain why prime moduli force useful power cycles.

Sources