Sub topic 7
Last Two Digits of Powers: Cycles and the 10k+1 Pattern
This chapter assumes you can reduce a number modulo 100, you know the unit-digit cycles of powers, and you are comfortable with the laws of exponents. The last two digits of a number are its remainder when divided by 100. To find them for a large power, you either find where the remainders start repeating, or you build a number of the form 10k+1, whose powers follow a simple rule.
Why the cycle is longer than for unit digits
Unit digits repeat after at most 4 powers. Last-two-digit remainders repeat too, but the cycles are longer. Take 7:
| n | 7^n | last two digits |
|---|---|---|
| 1 | 7 | 07 |
| 2 | 49 | 49 |
| 3 | 343 | 43 |
| 4 | 2401 | 01 |
| 5 | 16807 | 07 |
Once a power ends in 01, multiplying again simply repeats the start of the list. So the cycle length for 7 is 4.
Most bases take longer to return to 01. For a base that is coprime to 100 (not divisible by 2 or 5), the cycle length always divides 20. That gives a ready rule. If you cannot see the cycle length, test whether the base raised to 20 ends in 01.
The 01 anchor
Define the order of a base as the smallest power n such that a^n ends in 01. After that point the pattern restarts. To find the last two digits of a^N:
- Find the order of a, or a multiple of it that is easy to reach, such as 20.
- Reduce N modulo that number.
- Compute a^(remainder) by hand. A remainder of 0 means the answer is 01.
Some useful anchors, all coprime to 100:
| Base ends in | Power that gives 01 |
|---|---|
| 49, 51, 99 (for example 49², 51², 99²) | 2 |
| 7, 43 | 4 |
| 9, 11, 19, 21 | 10 (21 and 51 also work with 5 and 2 respectively) |
| 3, 13, 17, 33 | 20 |
Do not memorise this table. It is a map of which bases are quick. You can rebuild any row by squaring and checking.
Worked example: 7^2026
The order of 7 is 4. Since 2026 = 4 × 506 + 2, the remainder is 2, so 7^2026 ends in the same two digits as 7², which is 49.
Worked example: 43^101
43² = 1849, which ends in 49. Squaring again, 49² = 2401, which ends in 01. So the order of 43 is 4. Since 101 = 4 × 25 + 1, the answer is 43^1 = 43.
The 10k+1 pattern
A number of the form 10k+1 ends in 1. Examples are 11, 21, 31 and 81. Expand its power with the binomial theorem:
(10k + 1)^n = 1 + n·(10k) + C(n,2)·(10k)² + …
Every term from the third onward has a factor of 100, so it does not affect the last two digits. This leaves:
(10k + 1)^n ≡ 1 + 10kn (mod 100)
The unit digit is 1. The tens digit is the unit digit of k × n. So you only need to multiply k by n and keep its last digit.
Worked example: 21^2026
Here k = 2 and n = 2026. The product is k × n = 4052, so the tens digit is 2. The answer is 21.
Worked example: 31^45
Here k = 3 and n = 45, and k × n = 135. The tens digit is 5, so the answer is 51.
This is also why 11^n has its tens digit equal to n mod 10, and why 11^10 ends in 01.
Reaching 10k+1 from other bases
Most bases do not end in 1, but their powers often do. Look for a small power that ends in 1.
- 3^4 = 81, which has the form 10k+1 with k = 8.
- 7^4 = 2401, which ends in 01. This is the case k = 0.
- 9^2 = 81, with k = 8 again.
- 13^4 = 28561, which ends in 61, so k = 6.
Then write the large power as that small power raised to something, and apply the rule.
Worked example: 3^2026
Write 3^2026 = 3² × (3⁴)^506 = 9 × 81^506.
For 81^506, k = 8 and n = 506. The product is 8 × 506 = 4048, so the tens digit is 8. This gives 81^506 ≡ 81.
Then 9 × 81 = 729, which ends in 29. The answer is 29.
The same answer comes from the cycle method. The order of 3 is 20, and 2026 = 20 × 101 + 6. So 3^2026 ends like 3^6 = 729, which is again 29.
A choice of method
Bases that are not coprime to 100
If the base shares a factor with 100, the cycle does not return to 01. The pattern starts later or settles on a fixed value.
Bases ending in 5
For any number ending in 5, (10m + 5)² = 100m(m+1) + 25. So the square always ends in 25. Then 25² = 625 ends in 25 again, and every even power from 2 onward ends in 25.
Odd powers depend on the number. 25^n always ends in 25, and 75^n ends in 75 for odd n and 25 for even n.
Even bases
The powers of 2 do not return to 2. After the first two powers, they repeat with period 20. Another route is through 24 and 76:
- 2^10 = 1024, which ends in 24.
- 24² = 576 ends in 76, and 76² = 5776 ends in 76. Then 76^n ends in 76 for every n.
- 24^n ends in 24 for odd n and in 76 for even n.
Worked example: 2^100
2^100 = (2^10)^10, so it ends like 24^10. The exponent 10 is even, so the answer is 76. This matches the known value of 2^100, which ends in 376.
For any power of 2 with exponent at least 2, the last two digits repeat every 20 powers, so 2^2026 ends like 2^6, which is 64.
Checking with code
The built-in three-argument pow gives the answer directly. The program below also finds the order of a base, and applies the 10k+1 rule so you can compare it with pow.
def order_mod_100(a):
"""Smallest n >= 1 with a**n ending in 01. Requires gcd(a, 100) == 1."""
n, x = 1, a % 100
while x != 1:
x = (x * a) % 100
n += 1
return n
def last_two_10k1(base, n):
"""Last two digits of base**n when base ends in 1."""
k = (base % 100) // 10
return 10 * ((k * n) % 10) + 1
for a in (7, 3, 9, 11, 13, 49):
print(a, order_mod_100(a))
print(last_two_10k1(21, 2026), pow(21, 2026, 100))
print(last_two_10k1(31, 45), pow(31, 45, 100))
print(pow(7, 2026, 100), pow(3, 2026, 100), pow(2, 2026, 100))The orders printed are 4, 20, 10, 10, 20 and 2. Both pairs on the next two lines agree, giving 21 and 51. The final line prints 49, 29 and 64.
Common errors
- Using a unit-digit cycle for the last two digits. The cycle of 7 for the unit digit is 7, 9, 3, 1, but the last two digits go 07, 49, 43, 01, so the full values matter.
- Applying the 1 + 10kn rule to a base not ending in 1. It works only for 10k+1 forms. Convert first.
- Taking k from the whole number. In 321, the rule works modulo 100, so use 21 and k = 2, not 32.
- Forgetting that the cycle for even bases starts late. Check small exponents by hand before trusting the cycle.
Exercises
Exercise
Find the last two digits of 33^2027.
Show answer
77. The order of 33 divides 20, and indeed 33^20 ends in 01. Since 2027 = 20 × 101 + 7, the answer matches 33^7. We have 33² = 1089 (ends 89), 33³ ends in 37, 33⁴ ends in 21, and 33^7 = 33⁴ × 33³ ends in 21 × 37 = 777, so 77.
Exercise
Find the last two digits of 41^3000 and of 2^2026.
Show answer
For 41, k = 4 and n = 3000, so k × n = 12000. The tens digit is 0, so 41^3000 ends in 01. For 2^2026, powers of 2 repeat every 20 from exponent 2, and 2026 = 20 × 101 + 6, so it ends like 2^6 = 64.