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:

\text{last } k \text{ digits of } N \;=\; 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:

N = 3 141 592 653 5897 3 141 592 653 58 q = the rest × 10² + 97 r = last 2 digits N = q · 10² + r, so N mod 100 = r = 97.
Any integer splits cleanly at any power of ten. The right box is the last $k$ digits; the left box is everything else. Modding by $10^k$ deletes the left box.

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:

3^1 = 3, \quad 3^2 = 9, \quad 3^3 = 27 \equiv 7, \quad 3^4 = 81 \equiv 1, \quad 3^5 \equiv 3, \ldots

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

3^{100} \equiv 1 \pmod{10}.

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:

7^1 = 7, \quad 7^2 = 49, \quad 7^4 = 49^2 = 2401 \equiv 1 \pmod{100}.

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:

13^2 = 169, \quad 13^4 = 169^2 = 28561 \equiv 561 \pmod{1000}.
13^5 = 13^4 \cdot 13 \equiv 561 \cdot 13 = 7293 \equiv 293 \pmod{1000}.
13^{10} = (13^5)^2 \equiv 293^2 = 85849 \equiv 849 \pmod{1000}.
13^{20} = 849^2 = 720801 \equiv 801 \pmod{1000}.
13^{25} = 13^{20} \cdot 13^5 \equiv 801 \cdot 293 = 234693 \equiv 693 \pmod{1000}.
13^{50} = 693^2 = 480249 \equiv 249 \pmod{1000}.
13^{100} = 249^2 = 62001 \equiv 001 \pmod{1000}.

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":

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