Sub topic 15
Choosing a method under exam time pressure
This chapter assumes you know the division algorithm, congruence notation, remainders of sums and products, cyclicity of powers, Fermat's little theorem, Euler's theorem, Wilson's theorem, factorial remainders and the Chinese Remainder Theorem. Earlier chapters taught each tool. Here you learn to pick one in the first thirty seconds and to recognise when to stop and move on.
Why method choice matters
A CAT remainder question rarely names its method. It says "find the remainder when 7^100 is divided by 13" and leaves the choice to you. Several methods can work, but their costs differ a lot. Using Euler's theorem on a small modulus wastes time that a two-line cycle would save. Searching for a cycle on a large prime modulus can run for minutes when Fermat's little theorem finishes in seconds.
A good habit is to read the modulus first (the divisor), then the shape of the dividend (a product, a power, a factorial, an expression in a variable). These two facts usually decide the method.
Step 1: Read the modulus
The size and factorisation of the divisor point to different tools.
| Modulus | What it suggests |
|---|---|
| 2, 4, 5, 8, 10, 100 | Last digits or last two digits. Use cyclicity or divisibility tests. |
| 3, 9, 11 | Digit sums or alternating digit sums. Negative remainders (−1 for 11, for example). |
| A small prime such as 7 or 13 | Fermat's little theorem, or a short cycle. |
| A composite such as 12, 15, 35 | Split into coprime prime-power factors, then use CRT. Or use Euler's theorem when the base is coprime. |
| A prime close to the size of the factorial | Wilson's theorem. |
| A number just above or below the base, such as 6^n mod 7 or 10^n mod 9 | Negative remainders. |
Step 2: Read the shape of the dividend
| Shape | First method to try |
|---|---|
| Sum, difference or product of numbers | Reduce each factor, then combine. |
| a^n with a large n | Cycle, negative remainder, Fermat or Euler. |
| a^n ± b^n | Factor identities: a + b divides a^n + b^n for odd n, and a − b divides a^n − b^n for every n. |
| A polynomial in x divided by a linear factor | Remainder theorem: substitute the root. |
| n! or a sum of factorials | Cancel the terms that contain the modulus as a factor. |
| Several remainder conditions on one number | CRT or successive substitution. |
| Last digits | Cyclicity for one digit. Binomial or Euler reasoning for two digits. |
A decision flow
The diagram below turns the two tables into a path you can follow in your head.
Worked examples
Each example names the trigger that selects the method.
Example 1: Negative remainder
Find the remainder when 8^50 is divided by 9.
The base is 1 less than the modulus... in fact 8 ≡ −1 (mod 9), so 8^50 ≡ (−1)^50 = 1. The answer is 1. This takes one line. Euler's theorem would also work, since φ(9) = 6, but it takes longer.
Example 2: Fermat's little theorem
Find the remainder when 2^100 is divided by 13.
The modulus 13 is prime and 2 is coprime to it, so 2^12 ≡ 1. Since 100 = 12 × 8 + 4, 2^100 ≡ 2^4 = 16 ≡ 3. You can verify this in Python:
print(pow(2, 100, 13)) # 3
print(pow(2, 100 % 12, 13)) # 3Example 3: A short cycle on a small modulus
Find the remainder when 7^100 is divided by 5.
Here 7 ≡ 2 (mod 5), and 2^4 = 16 ≡ 1, so the cycle has length 4. Since 100 is a multiple of 4, 7^100 ≡ 1. The cycle is short enough that you do not need a theorem.
Example 4: Euler's theorem with a composite modulus
Find the remainder when 7^222 is divided by 20.
The modulus is composite and gcd(7, 20) = 1. Now φ(20) = 20 × (1 − 1/2) × (1 − 1/5) = 8. Since 222 = 8 × 27 + 6, 7^222 ≡ 7^6. Next 7^2 = 49 ≡ 9, 7^4 ≡ 81 ≡ 1, so 7^6 ≡ 7^2 ≡ 9. The remainder is 9.
print(pow(7, 222, 20)) # 9Example 5: A factorial with a prime modulus
Find the remainder when 12! is divided by 13.
The modulus is prime and the factorial is exactly (p − 1)!. Wilson's theorem gives (p − 1)! ≡ −1 ≡ 12.
import math
print(math.factorial(12) % 13) # 12If instead the question is "remainder of 1! + 2! + ... + 20! divided by 12", note that from 4! onward every term is a multiple of 12. Only 1! + 2! + 3! = 9 remains, so the remainder is 9.
Example 6: Several conditions
A number leaves remainder 2 on division by 3, 3 on division by 5, and 2 on division by 7. Find the smallest such number.
The moduli are pairwise coprime, so the number is unique below 105. Successive substitution is faster than a formal CRT here. Start with the largest modulus: the number is 7k + 2. Check k = 0, 1, 2, 3 against mod 5: 2, 9, 16, 23 give remainders 2, 4, 1, 3. So 23 works for mod 5 (k = 3). Now 23 mod 3 = 2, which matches. The answer is 23.
x = next(x for x in range(105) if x % 3 == 2 and x % 5 == 3 and x % 7 == 2)
print(x) # 23Common errors under time pressure
- Applying Fermat or Euler when the base shares a factor with the modulus. The theorems need gcd(a, n) = 1. For 6^100 mod 15, the base and modulus share the factor 3, so split into mod 3 and mod 5 and use CRT.
- Using φ(n) as the cycle length when a shorter cycle exists. The theorem gives a valid period, not always the shortest. This is fine for reduction, but it means you may do more work than needed.
- Reducing exponents with the wrong modulus. For Fermat you reduce the exponent mod p − 1, not mod p. For Euler you reduce mod φ(n).
- Forgetting that a negative remainder must be converted back. If your working gives −3 mod 7, the reported answer is 4.
- Ignoring that the quotient depends on the sign convention. Python's
%returns a non-negative value for a positive divisor, so(-7) % 5is 3. Calculator-style or hand-written work can give −2. Always report the value in the range 0 to n − 1. - Spending too long on a hard variant. If you have no method after about forty seconds, mark the question and move on.
Checking an answer fast
You rarely have a calculator on CAT, so build quick checks into your habit.
- Parity check. If the dividend is odd and the modulus is even, the remainder must be odd.
- Range check. The remainder is always between 0 and the divisor minus 1.
- Small-exponent test. Try the method on 7^2 or 7^3 and compare with direct calculation before trusting a formula on 7^100.
- Second route. When the question is worth it, solve it by a different method (for example cycle and Fermat) and confirm the two agree.
Allocating time
Remainder questions are usually worth the same marks as any other question in the section, so your goal is a fair price in time.
- Under 45 seconds. Direct reduction, negative remainders, divisibility tests, short cycles.
- 45 to 90 seconds. Fermat, Euler with a small totient, factorial cancellation, a two-condition CRT.
- Over 90 seconds. A multi-step CRT with large moduli, or two-digit last-digit problems with unusual bases. Skip these on the first pass and return if time remains.
Exercise
Find the remainder when 3^200 is divided by 17, and name the trigger that picks your method.
Show answer
The modulus 17 is prime and gcd(3, 17) = 1, so Fermat's little theorem applies: 3^16 ≡ 1 (mod 17). Since 200 = 16 × 12 + 8, 3^200 ≡ 3^8. Now 3^4 = 81 ≡ 81 − 68 = 13 ≡ −4, so 3^8 ≡ 16 ≡ −1 ≡ 16. The remainder is 16.
Exercise
Find the remainder when 1! + 2! + 3! + ... + 50! is divided by 15, and say which factorials you can ignore.
Show answer
From 5! onward, each factorial contains both 3 and 5, so it is a multiple of 15 and leaves remainder 0. Only 1! + 2! + 3! + 4! = 1 + 2 + 6 + 24 = 33 remains, and 33 mod 15 = 3. The remainder is 3.
Exercise
Find the remainder when 6^100 is divided by 15. Explain why Euler's theorem cannot be used directly.
Show answer
gcd(6, 15) = 3, so the base and modulus are not coprime and Euler's theorem does not apply. Split the modulus. Mod 3: 6 ≡ 0, so 6^100 ≡ 0. Mod 5: 6 ≡ 1, so 6^100 ≡ 1. We need x ≡ 0 (mod 3) and x ≡ 1 (mod 5). Numbers that are 1 mod 5 are 1, 6, 11, ...; 6 is divisible by 3. The remainder is 6.
Exercise
A number leaves remainder 4 when divided by 6 and remainder 1 when divided by 5. Why can you not apply the standard CRT directly, and what is the smallest such number?
Show answer
The moduli 6 and 5 are coprime, so CRT does apply directly. The solution is unique below 30. Numbers that are 1 mod 5: 1, 6, 11, 16, 21, 26. Of these, 16 leaves remainder 4 on division by 6. The smallest number is 16.