Finding the Last Digit of a Huge Power
The last digit of any power like 7 to the 2026th cycles in a short, predictable pattern — spotting and using that cycle turns an impossible-looking arithmetic question into a two-step calculation.
What is the last digit of ? Computing directly is absurd — it has well over a thousand digits. But the question only asks for the last digit, and last digits of powers of any single-digit base repeat in a short cycle, because the last digit of a product depends only on the last digits of its factors. You never need the whole number, only its remainder when divided by 10.
The core idea: last digits cycle because multiplication "forgets" everything except the last digit
When you multiply two numbers, the last digit of the product depends only on the last digits of the two numbers being multiplied — the hundreds, thousands, and higher digits never affect it. So the sequence of last digits of is determined entirely by repeatedly multiplying the previous last digit by 7 and keeping only the new last digit. Since there are only 10 possible last digits, this process must eventually repeat — and for powers of a fixed base, the repeating cycle is usually short (length 1, 2, or 4 for base-10 last digits).
Working example: the cycle of powers of 7
(last digit 7). (last digit 9). (last digit 3). (last digit 1). (last digit 7) — back to where we started. So the last digit of powers of 7 cycles with period 4:
To find the last digit of , find where 2026 falls in this cycle of length 4 by computing the remainder of 2026 divided by 4: , so . The exponent's position in the cycle is the same as exponent 2 (since the cycle restarts every 4 steps, and exponent 4 itself corresponds to position 4, i.e., the last entry). Exponent 2 in the cycle gives last digit 9 (from ). So ends in 9.
Worked example 2: a base with a shorter cycle
What's the last digit of ? Compute the cycle: (last digit 4), (last digit 2), (last digit 6), (last digit 8) — cycle length 4 again: . Find : , so remainder 3, corresponding to the 3rd entry in the cycle: 2. So ends in 2. Note the general pattern across digits 0–9: last digits 0, 1, 5, 6 have cycle length 1 (they never change); 4 and 9 have cycle length 2; 2, 3, 7, 8 have cycle length 4 — worth memorizing as a shortcut so you don't need to recompute the cycle length from scratch each time.
To find the last digit of , find the (short, at most length-4) repeating cycle of last digits of powers of , then use to find where in the cycle falls — never compute the full power.
What this means in practice
This is the simplest entry point into modular arithmetic, the tool behind cryptographic checksums, hash functions, and any system that needs a fast, fixed-size fingerprint of a huge number. In an interview, it's also a speed test: recognizing "I only need the cycle" versus attempting brute-force multiplication under time pressure is exactly the kind of quick reframing that separates a fast, correct answer from a stalled one.
Memorize the cycle-length table by last digit — 1 for , 2 for , 4 for — so you can jump straight to computing without re-deriving the cycle from scratch every time.
Related concepts
Practice in interviews
Further reading
- Niven, Zuckerman & Montgomery, An Introduction to the Theory of Numbers, ch. 2