A specific kind of question keeps showing up in JEE papers, RMO shortlists, and competitive coding rounds: "Find the last two digits of 7^{2024}" or "What are the last three digits of 2^{100}?" The numbers involved are astronomical — 7^{2024} has over 1700 digits — so there is no hope of computing them directly. Yet these problems have clean, small answers.
The reason they are solvable at all is one of the most useful translations in all of elementary number theory: the last k digits of any integer N are exactly N \bmod 10^k. The moment you recognise a problem is asking about the last k digits, you should immediately stop thinking about the number itself and start thinking about residues modulo 10^k.
This article is about the general pattern. If you have already met the last-digit switch to mod 10, this is the grown-up version of that reflex — the one you will actually need for two- and three-digit tail problems.
The translation
The claim is simple. For any non-negative integer N and any k \geq 1:
- Last 1 digit of N is N \bmod 10.
- Last 2 digits of N are N \bmod 100.
- Last 3 digits of N are N \bmod 1000.
- Last k digits of N are N \bmod 10^k.
Why: In decimal, any integer N can be written as N = q \cdot 10^k + r, where r consists of exactly the last k digits of N (possibly with leading zeros) and q is everything to the left. Dividing by 10^k, the quotient is q and the remainder is r. But N \bmod 10^k is by definition that remainder. So N \bmod 10^k = r = last k digits.
A picture of the split
Every integer can be chopped into two pieces at any power of ten. Here is the decomposition for k = 2:
Once you see this picture, the translation is no longer a theorem you remember — it is just obvious. The last k digits and N \bmod 10^k are the same object wearing different labels.
Worked example 1 — last digit of 3^{100}
This is the warm-up. We want 3^{100} \bmod 10.
Compute the cycle of 3^n \bmod 10:
The cycle is 3, 9, 7, 1 with length 4. Why: Once 3^4 \equiv 1 \pmod{10}, multiplying by another 3 just restarts the sequence. Every power of 3 is completely determined by its exponent mod 4.
Reduce the exponent: 100 = 4 \cdot 25 + 0, so 100 \equiv 0 \pmod 4. Position 0 in the cycle corresponds to 3^4 \equiv 1. Therefore
The last digit of 3^{100} is 1.
Worked example 2 — last two digits of 7^{2024}
Now the general pattern earns its keep. "Last two digits" means mod 100. So we want 7^{2024} \bmod 100.
Step 1: Find the cycle length mod 100. Euler's theorem says that since \gcd(7, 100) = 1, we have 7^{\phi(100)} \equiv 1 \pmod{100}, where \phi(100) = 100 \cdot (1 - 1/2)(1 - 1/5) = 40. So the cycle length divides 40 — but in practice it is often shorter. Let's find the actual order by computing:
So 7^4 \equiv 1 \pmod{100} — the cycle length is just 4, not 40. Why: The order of 7 mod 100 must divide \phi(100) = 40, and by direct check it divides 4. Lucky, but easy to verify.
Step 2: Reduce the exponent mod 4. 2024 = 4 \cdot 506, so 2024 \equiv 0 \pmod 4.
Step 3: Read off the answer. 7^{2024} = (7^4)^{506} \equiv 1^{506} \equiv 1 \pmod{100}.
The last two digits of 7^{2024} are 01.
Notice how cleanly the method scales. The exponent 2024 never got anywhere near a computer; all we did was find a cycle of length 4 mod 100 and reduce.
Worked example 3 — last three digits of 13^{100}
"Last three digits" means mod 1000. We want 13^{100} \bmod 1000.
Here \phi(1000) = 1000 \cdot (1 - 1/2)(1 - 1/5) = 400, so the cycle length divides 400 — usually too large to walk through by hand. A cleaner attack uses binary exponentiation:
The last three digits of 13^{100} are 001.
Every arithmetic step stayed inside three-digit numbers. That is the point: after translating to mod 1000, all the enormous intermediate powers of 13 get chopped down to their last three digits at every step, and the work stays human.
The recognition reflex
The moment you read any of these phrases in a problem, your brain should say "mod 10^k":
- "last digit of" — mod 10
- "units digit of" — mod 10
- "last two digits" / "tens and units digits" — mod 100
- "last three digits" — mod 1000
- "ends in …" — mod 10, 100, or 1000 depending on how many digits they want
- "when N is written in decimal, the final k digits are…" — mod 10^k
You should not spend a single second thinking about the actual value of 7^{2024} or 13^{100}. The work is always: translate, reduce the exponent via Euler / direct cycle, compute in residues.
Why it works in one sentence
Modular arithmetic is compatible with addition, subtraction, and multiplication. So every step of a computation — no matter how many digits the intermediate values have — can be carried out modulo 10^k from the start, and the answer at the end is still correct mod 10^k. Since "last k digits of N" is N \bmod 10^k, you are answering the original question the whole time, just with smaller numbers.
One-line takeaway
The last k digits of N are exactly N \bmod 10^k. Every "find the last digit / last two digits / last three digits" problem is a modular arithmetic problem in disguise — translate immediately and the work becomes elementary.
Related: Modular Arithmetic · Last Digit Problems — Switch to Mod 10 · Last Digit of 7^n Cycle Animator · Try Small Cases First