Sub topic 8
Remainders and Divisibility: Testing Options Against Number Conditions
This chapter assumes you can find a remainder by hand, know the divisibility tests for 2, 3, 4, 5, 9 and 11, and have seen the basic back-substitution routine from the earlier chapters. Here the routine meets its most natural use: questions where a number must satisfy several remainder or divisibility conditions at once.
Why remainder questions suit back-substitution
A remainder condition is easy to check and hard to solve for. Checking "does 59 leave remainder 3 when divided by 4?" takes a few seconds. Finding a number that satisfies three such conditions from scratch means building congruences, and that is slow under exam pressure.
The options also arrive already filtered. Every option is a whole number, so you never need to ask whether the answer is an integer. The only work is checking each candidate against every condition.
Two facts do most of the work:
- A remainder is always smaller than the divisor. "Remainder 6 when divided by 5" is impossible.
- If N leaves remainder r when divided by d, then N − r is a multiple of d. The numbers that satisfy one condition are r, r + d, r + 2d, and so on.
The basic routine on a three-condition question
Question. What is the smallest number that leaves remainders 2, 3 and 4 when divided by 3, 4 and 5 respectively? Options: 29, 59, 119, 179.
Test the options in increasing order, because the question asks for the smallest.
- 29 divided by 3 leaves 2. This passes. 29 divided by 4 leaves 1, not 3, so 29 fails.
- 59 divided by 3 leaves 2, divided by 4 leaves 3, and divided by 5 leaves 4. All three conditions pass.
The answer is 59. You do not need to test 119 or 179. In fact both also pass, because 119 = 59 + 60 and 179 = 59 + 120. The word "smallest" is what selects 59.
# Smallest n leaving remainders 2, 3, 4 when divided by 3, 4, 5.
options = [29, 59, 119, 179]
for n in options: # options are in increasing order
if n % 3 == 2 and n % 4 == 3 and n % 5 == 4:
print(n) # prints 59
breakA pattern is hiding here. Each remainder is one less than its divisor, so n + 1 is divisible by 3, 4 and 5. That makes n + 1 a multiple of 60, and the valid numbers are 59, 119, 179, and so on. You don't need this insight to answer the question. It does explain why several options pass.
Eliminating options before you calculate
Divisibility rules give a quick filter on the digits. Apply the cheapest filter first.
| Condition on N | Quick check |
|---|---|
| Remainder r when divided by 2, 5 or 10 | Look at the units digit. For divisor 5, the units digit must be r or r + 5 |
| Remainder r when divided by 4 | Take the last two digits and divide by 4 |
| Remainder r when divided by 3 or 9 | Add the digits and find the remainder of the sum |
| Remainder r when divided by 11 | Alternating digit sum, taken from the right |
Question. Which of 121, 134, 139, 154 leaves remainder 4 when divided by 5 and remainder 1 when divided by 6?
The first condition needs a units digit of 4 or 9. That removes 121 at once, since its units digit is 1. Now test the rest against 6:
- 134 = 132 + 2, remainder 2. It fails.
- 139 = 138 + 1, remainder 1. It passes.
- 154 = 150 + 4, remainder 4. It fails.
The answer is 139. One glance at the units digits removed an option before any division was done.
Which option to test first
You can choose the order of testing in two ways.
- Order the conditions. Check the condition that is cheapest and that rules out the most options first. A units-digit check against 5 or 10 is nearly free.
- Order the options. If the question says "smallest", start from the smallest option. If it says "largest", start from the largest. The first option that passes is the answer, provided the options are in order.
Question. What is the largest three-digit number that leaves remainder 3 when divided by 8 and remainder 5 when divided by 6? Options: 971, 983, 995, 997.
The question asks for the largest, so start from the top.
- 997 divided by 8: 992 is a multiple of 8, so the remainder is 5. It fails.
- 995 divided by 8: the remainder is 3. 995 divided by 6: 990 is a multiple of 6, so the remainder is 5. It passes.
The answer is 995. We never tested 983 or 971. In fact 971 also passes, because 995 − 971 = 24 and 24 is the lowest common multiple of 8 and 6. So testing from the wrong end would have given the wrong answer.
def passes(n):
return n % 8 == 3 and n % 6 == 5
options = [971, 983, 995, 997]
for n in sorted(options, reverse=True): # "largest": start from the top
if passes(n):
print(n) # prints 995
breakDivisibility with a missing digit
Questions of the form "for which digit k is the number 3k57 divisible by 9?" are checked the same way. Substitute each option for k and apply the digit-sum rule.
The digit sum is 3 + k + 5 + 7 = 15 + k. For divisibility by 9 this must be a multiple of 9. The only multiple of 9 reachable with a single digit is 18, so k = 3. If the options are 1, 3, 5, 7, you can see this by testing: 16, 18, 20, 22. Only 18 is a multiple of 9.
For divisibility by 4, a missing digit in the tens place of the last two digits needs the full two-digit test. For divisibility by 11, keep the alternating sum with the correct signs, and remember that a result of 0 or ±11 also counts.
When back-substitution does not help
Some remainder questions give options that are not candidates for the number at all.
Question. What is the remainder when 7¹⁰⁰ is divided by 5? Options: 1, 2, 3, 4.
The options are possible remainders, not possible values of the number. You cannot divide 7¹⁰⁰ by 5 by hand, so testing options does not work. Solve directly. Since 7 leaves remainder 2 when divided by 5, the question is the same as finding the remainder of 2¹⁰⁰. The remainders of powers of 2 repeat every four steps: 2, 4, 3, 1. Because 100 is a multiple of 4, the remainder is 1.
Back-substitution also gains little when the conditions are few and simple. If you can see at once that n + 1 must be a multiple of 60, writing the answer directly is faster than testing.
Pitfalls specific to remainder problems
- Stopping after one condition. An option like 29 passes the mod 3 test and still fails mod 4. Every condition must be checked, and the check should stop only when one fails or all pass.
- Several options pass. Valid numbers repeat every L, where L is the lowest common multiple of the divisors. The words "smallest", "largest" or "less than 100" decide between them.
- Reading the wrong divisor. "Leaves remainder 3 when divided by 8" means N = 8q + 3. Check 8, not 3.
- Remainder 0. "Divisible by d" is the same as remainder 0 when divided by d. Do not look for remainder d.
- Arithmetic slips with large numbers. Subtract a nearby multiple of the divisor instead of dividing: 995 − 990 = 5 is quicker than long division by 6.
- Impossible remainders. If a remainder is not smaller than the divisor, the condition has been misread. Check it again.
Summary of the method
- Note the conditions and whether the question asks for the smallest or the largest.
- Use digit rules to cross out options before dividing.
- Test the remaining options from the correct end, checking every condition.
- Stop at the first option that passes all conditions.
- If the options are remainders rather than candidate numbers, solve directly.
Exercise
Which of 38, 52, 58, 82 leaves remainder 3 when divided by 5 and remainder 4 when divided by 6?
Show answer
The remainder 3 when divided by 5 needs a units digit of 3 or 8. This removes 52 and 82. Now test the rest against 6. 38 = 36 + 2 leaves 2, so it fails. 58 = 54 + 4 leaves 4, so it passes. The answer is 58.
Exercise
What is the remainder when 7^100 is divided by 5? Options: 1, 2, 3, 4. Can you answer by back-substituting the options, and if not, how do you find it?
Show answer
No. The options are possible remainders, not possible values of the number, so there is nothing to substitute into the expression. Solve directly. 7 leaves remainder 2 when divided by 5, so the remainder of 7^100 matches that of 2^100. Powers of 2 leave remainders 2, 4, 3, 1 in a cycle of length 4. Since 100 is a multiple of 4, the remainder is 1.