Sub topic 8
Splitting mod 100 into mod 4 and mod 25
Prerequisites and the main idea
Assume you can work with remainders, prime factorisation, and laws of exponents. You should also know that the last two digits of an integer are its remainder modulo 100.
For example, if a number leaves remainder 37 when divided by 100, it ends in 37. The direct modulo 100 calculation can sometimes be difficult. A useful alternative is to split the problem into two smaller calculations:
- Find the remainder modulo 4.
- Find the remainder modulo 25.
- Reconstruct the unique remainder modulo 100.
This works because:
- \(100=4\times25\)
- 4 and 25 have no common factor other than 1.
- Every pair of compatible remainders modulo 4 and modulo 25 determines exactly one remainder modulo 100.
This reconstruction is an application of the Chinese remainder theorem.
Reconstructing a remainder
Suppose an integer \(N\) satisfies
\[ N\equiv r_4\pmod 4 \]
and
\[ N\equiv r_{25}\pmod {25}. \]
Every number with remainder \(r_{25}\) modulo 25 has the form
\[ N=r_{25}+25t. \]
Now impose the condition modulo 4. Since \(25\equiv1\pmod4\),
\[ r{25}+25t\equiv r{25}+t\pmod4. \]
Therefore,
\[ t\equiv r4-r{25}\pmod4. \]
Choose \(t\) from \(0,1,2,3\), substitute it into \(r_{25}+25t\), and the result is the remainder from 0 to 99.
| Information | Calculation |
|---|---|
| \(N\equiv3\pmod4\), \(N\equiv17\pmod{25}\) | \(t\equiv3-17\equiv2\pmod4\) |
| Reconstruct \(N\) modulo 100 | \(17+25(2)=67\) |
Thus, \(N\equiv67\pmod {100}\), so the last two digits are 67.
Worked example: a large power
Find the last two digits of \(3^{2026}\).
Step 1: Work modulo 4
Because \(3\equiv-1\pmod4\),
\[ 3^{2026}\equiv(-1)^{2026}\equiv1\pmod4. \]
Step 2: Work modulo 25
The powers of 3 modulo 25 repeat. In fact,
\[ 3^{20}\equiv1\pmod {25}. \]
Reduce the exponent:
\[ 2026\equiv6\pmod {20}. \]
So,
\[ 3^{2026}\equiv3^6=729\equiv4\pmod {25}. \]
We now need a number \(N\) such that
\[ N\equiv1\pmod4,\qquad N\equiv4\pmod {25}. \]
Write \(N=4+25t\). The modulo 4 condition gives
\[ t\equiv1-4\equiv-3\equiv1\pmod4. \]
Taking \(t=1\),
\[ N=4+25=29. \]
Therefore, the last two digits of \(3^{2026}\) are 29.
# Verify the last two digits directly.
print(pow(3, 2026, 100)) # 29When this method helps
The mod 4 and mod 25 split is especially useful when:
- The number has a large exponent.
- The base has a simple pattern modulo 4.
- Powers modulo 25 are easier to reduce than powers modulo 100.
- You can use different cycles for the two moduli.
For a number ending in an even digit, powers modulo 100 may also become zero after enough factors of 2 and 5 appear. The split method still works, but always check whether the base shares factors with 4 or 25. Cycle shortcuts that assume a coprime base may fail in those cases.
A quick checking strategy
After finding a candidate last-two-digit result, check both conditions:
- Divide the candidate by 4 and verify the remainder \(r_4\).
- Divide the candidate by 25 and verify the remainder \(r_{25}\).
For the example, \(29\div4\) leaves remainder 1 and \(29\div25\) leaves remainder 4. Both conditions hold.
Exercise
An integer N satisfies N ≡ 2 mod 4 and N ≡ 11 mod 25. What are the last two digits of N?
Show answer
Write N = 11 + 25t. Then t ≡ 2 - 11 ≡ -9 ≡ 3 mod 4. Thus N = 11 + 25(3) = 86, so the last two digits are 86.