Your cousin Prapti is in Grade 10, and she likes to set you riddles at the dinner table. Tonight, between the dal and the rice, she writes on the back of an envelope: 3¹⁰⁰.
“That is 3 multiplied by itself a hundred times,” she says. “The answer has 48 digits. No calculator at home can show it, and nobody here could multiply it out before bedtime. But I can tell you its last digit before you finish your plate. Can you?”
It sounds impossible. To know how a number ends, surely you have to know the number. But try a few small powers of 3 first, and watch only their last digits. Something happens very quickly.
Guess first. What is the last digit of 3¹⁰⁰?
Pick an answer to see why.
Try it
Watch only the last digit
Here are the first twelve powers of 3. Each one is the one before, times 3.
| Power | 3¹ | 3² | 3³ | 3⁴ | 3⁵ | 3⁶ | 3⁷ | 3⁸ | 3⁹ | 3¹⁰ | 3¹¹ | 3¹² |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Value | 3 | 9 | 27 | 81 | 243 | 729 | 2,187 | 6,561 | 19,683 | 59,049 | 177,147 | 531,441 |
| Last digit | 3 | 9 | 7 | 1 | 3 | 9 | 7 | 1 | 3 | 9 | 7 | 1 |
The numbers grow fast, but the last digits don’t care: 3, 9, 7, 1, then 3, 9, 7, 1 again, and again. Every fourth power ends in 1, and then the same four endings start over.
- a.Which powers in the table end in 1? What do those powers (4, 8, 12) have in common?
- b.Without multiplying, say how 3¹⁶ and 3¹⁷ end. Check with the widget.
- c.Where does 100 come in the pattern?
The last digits go 3, 9, 7, 1 and repeat. What is the last digit of 3¹³?
Pick an answer to see why.
Now Prapti’s riddle. The rounds of four end at powers 4, 8, 12, 16, …, at every multiple of 4. 100 = 4 × 25 is a multiple of 4, so 3¹⁰⁰ is the last power of the 25th round: it ends in 1, like 3⁴ = 81. That is the whole trick, and it takes less time than a mouthful of rice.
Only the last digit matters
Why should the last digits repeat at all? Look at how you multiply by 3 on paper.
You start at the right, with the ones: 7 × 3 = 21, so you write 1 and carry 2 to the tens. Then the tens, the hundreds, the thousands, each carrying to the left. Nothing ever comes back to the right. So the last digit of a product depends only on the last digits of the numbers multiplied. The 2, the 1 and the 8 of 2,187 never touch the 1 at the end of 6,561 (Figure 44.1).
That means you can forget everything but the last digit. To get the next last digit in the table, take the last one, multiply by 3, and keep only the ones digit of that:
3 → 9 → 27, keep 7 → 21, keep 1 → 3 → 9 → …
Once 1 comes back, the next step is 1 × 3 = 3, exactly as at the start, and so the same four endings must follow, forever. The chain of last digits is like a path round a small field: once you are back at the gate, you will walk the same way again.
What’s going on
Cycles and remainders
A pattern that comes back to where it started and then repeats is called a cycle, and the number of steps in it is the cycle’s length. The last digits of the powers of 3 go round a cycle of length 4: 3, 9, 7, 1.
To find where a power lands, count how many full turns of the cycle fit, and see what is left over. That is a division with remainder:
| Power | Divide by 4 | Left over | Last digit |
|---|---|---|---|
| 3¹³ | 13 = 4 × 3 + 1 | 1 | 3, the first ending |
| 3¹⁸ | 18 = 4 × 4 + 2 | 2 | 9, the second |
| 3⁵¹ | 51 = 4 × 12 + 3 | 3 | 7, the third |
| 3¹⁰⁰ | 100 = 4 × 25 + 0 | 0 | 1, the fourth |
The full turns change nothing: each one ends on 1, ready to start again. Only the remainder of the power, divided by 4, decides the last digit: remainder 1 gives 3, remainder 2 gives 9, remainder 3 gives 7, and remainder 0 gives 1.
What is the last digit of 3²⁰²⁶?
Pick an answer to see why.
Every last digit has a cycle
The same reasoning works for any number. A number’s powers end the way the powers of its last digit end: 2,027 multiplied by itself any number of times ends like 7 multiplied by itself that many times, since only the 7 ever reaches the ones place. So ten cycles tell you the ending of every power there is.
| Last digit | Powers end in | Cycle length |
|---|---|---|
| 0 | 0, 0, 0, … | 1 |
| 1 | 1, 1, 1, … | 1 |
| 2 | 2, 4, 8, 6, then again | 4 |
| 3 | 3, 9, 7, 1, then again | 4 |
| 4 | 4, 6, then again | 2 |
| 5 | 5, 5, 5, … | 1 |
| 6 | 6, 6, 6, … | 1 |
| 7 | 7, 9, 3, 1, then again | 4 |
| 8 | 8, 4, 2, 6, then again | 4 |
| 9 | 9, 1, then again | 2 |
Try a few with the widget: choose a number and slide the power.
Every cycle has length 1, 2 or 4. Since 1 and 2 both go into 4, every last digit repeats after four steps, even when its cycle is shorter: 9, 1, 9, 1 is also “9, 1, 9, 1, then again” in fours. So the fifth power of any number ends in the same digit as the number itself: 2⁵ = 32, 7⁵ = 16,807, 13⁵ = 371,293. Ask a friend for any whole number and its fifth power on a calculator; you can tell them the last digit before they press =.
Remainders that come round
The last digit is a remainder
The last digit of a number is what is left over when you divide it by 10: 2,187 = 10 × 218 + 7. So all of this has been about remainders. Keeping only the remainder, and going round and round, is modular arithmetic, or clock arithmetic: the last digit is a clock with ten numbers, 0 to 9. The week is a clock of seven, as in What Day of the Week Will Your 100th Birthday Be?, and the two ideas fit together.
Powers of days
The powers of 3 also cycle when divided by 7, but in a longer cycle: 3, 2, 6, 4, 5, 1, of length 6. For the remainder on dividing by 7 there are six possible remainders (1 to 6) for a power of 3 to visit, and it visits all of them before coming home. On dividing by 10, there were only four endings (1, 3, 7, 9) it could ever visit.
Harder puzzles
The last digit of a sum
To find the last digit of a sum, add the last digits: the carries in adding also go only to the left.
What is the last digit of 3¹⁰⁰ + 7¹⁰⁰?
Pick an answer to see why.
The last two digits
The column picture works for two columns too: carries go left, so the last two digits of a product depend only on the last two digits of the numbers multiplied. Keep only the last two digits, multiply by 3, keep the last two again:
03, 09, 27, 81, 43 (from 81 × 3 = 243), 29, 87, 61, 83, 49, 47, 41, 23, 69, 07, 21, 63, 89, 67, 01, and then 03 again.
The last two digits of the powers of 3 go round a cycle of length 20. 100 = 20 × 5, so 3¹⁰⁰ is the end of the fifth round: its last two digits are 01, as the full number showed.
The powers of 7 are kinder: 07, 49, 43, 01, and round again, a cycle of only 4, because 7⁴ = 2,401 already ends in 01. So 7²⁰²⁶ (2026 = 4 × 506 + 2) ends in 49, like 7² = 49.
The twist: a cycle that doesn’t start at the start
Now choose 2 in the widget. The last two digits of its powers go 02, 04, 08, 16, 32, 64, 28, 56, 12, 24, 48, 96, 92, 84, 68, 36, 72, 44, 88, 76, then 52, and 52 × 2 = 104 ends in 04. The cycle has come back, but not to 02: to 04. From 2² on, the endings go round a cycle of 20, and 02 never appears again.
Why? Every power of 2 from 2² on is a multiple of 4, and a number is a multiple of 4 exactly when its last two digits are (the test in Why Do the Divisibility Tests Work?). 02 is not a multiple of 4, so no later power can end in 02. The path has a tail before it reaches its loop, like the Greek letter ρ.
So a power’s endings always come round in the end (there are only 100 possible pairs of last digits, so one must come back), but the cycle need not begin at the first power. For the last two digits of 2ⁿ, count the steps from 2² instead of from 2¹: 2¹⁰⁰ is 98 steps after 2², and 98 = 20 × 4 + 18, so it ends like 2²⁰, in 76. Before you trust a cycle, check where it really starts.
Where this is used
Questions
★ What is the last digit of 2³⁰?
Pick an answer to see why.
Shreya says 9²⁰²⁷ ends in 1, because “9 times 9 is 81”. Is she right?
Hint
Answer
What is the last digit of 2026²⁰²⁶?
Answer
★★ What is the last digit of 47³⁵?
Pick an answer to see why.
Nishant wants the last digit of 13⁴¹ × 2⁹ without a calculator. Find it.
Hint
Answer
What is the last digit of 4²⁰²⁶ + 6²⁰²⁶?
Answer
Today is a Tuesday. Yangchen says that 10⁶ days from now, a million days, it will be a Tuesday again. Is she right? Use the remainders of 10, 100, 1,000, … divided by 7.
Hint
Answer
★★ A perfect square is a number times itself, like 49 = 7 × 7. Which of these can a perfect square never end in?
Pick an answer to see why.
Saugat adds the fourth powers 1⁴ + 2⁴ + 3⁴ + … + 100⁴. What is the last digit of his total?
Hint
Answer
Aisha says 2²⁰²⁶ + 1 can be divided exactly by 5. Without working out the number, show that she is right.
Answer
Find the smallest power of 3, bigger than 3⁰ = 1, whose last two digits are 01, and use it to find the last two digits of 3²⁰²⁶.
Hint
Answer
Where to go next
- What Day of the Week Will Your 100th Birthday Be? The week as a clock of seven: remainders that tell the day of any date.
- Why Do the Divisibility Tests Work? Why only the last two digits decide whether a number divides by 4, and the other tests by remainders.
- What Is the Biggest Number Anyone Has Used? (Grades 9–12) The last digit of a tower of 3s, and of Graham’s number, by these cycles one level at a time.
- How Can Two Strangers Agree on a Secret in Public? (Grades 9–12) Powers on a clock, worked out fast by squaring, and why they come back to 1: the internet’s locks.
- How Does a Computer Roll a Die? (Computing, Going Further) Remainders that go round in a cycle, as a program.
- Grade 8, Indices: the laws of indices behind every power on this page.
Where these facts come from
- Fermat’s letter of 18 October 1640 to Frénicle de Bessy, its statement that the power’s exponent divides the prime minus one, and Fermat’s line that he would send a proof if he did not fear its length (the French original, our own translation); Euler’s first published proof of 1736, and Leibniz’s unpublished one from before 1683: Wikipedia, “Fermat’s little theorem”, read November 2026.
- Euler’s proof of Fermat’s rule presented on 2 August 1736 (published 1741); his paper “Theoremata arithmetica nova methodo demonstrata”, published in 1763, and the proof that multiplying by a number with no common factor shuffles the remainders: Wikipedia, “Euler’s theorem”, read November 2026.
- Euler introducing the count in 1763, and Sylvester naming it “totient” in 1879: Wikipedia, “Euler’s totient function”, read November 2026.
- Modular exponentiation and its use in public-key cryptography, RSA and Diffie–Hellman: Wikipedia, “Modular exponentiation”, read November 2026.
- Linear congruential generators (one of the oldest pseudorandom number generators; the period; low bits with a shorter period when the modulus is a power of 2): Wikipedia, “Linear congruential generator”, read November 2026.
- Every number, last digit, cycle, remainder and answer in this topic computed in
checks/textbooks/math-further-6-8/44/tmp/t44_numbers.py.
Found a mistake? Please tell us.
