A 12-hour clock does not stop at 12: five hours after 10, it shows 3. This laboratory uses that idea to explore remainders, divisibility and increasingly rich problems. Open “Why does it work?” at each step, then try the tools.
Step 1 / 15
The clock of remainders
After a full turn, we return to the same point. Only the distance beyond complete turns matters.
10+5=15 ≡ 3 (mod 12)
Example: 17, 29 and 41 all leave remainder 5 on division by 12.
Why does it work?
The differences between these numbers are multiples of 12: the number of turns changes, but not the position.
Step 2 / 15
What congruence means
Two integers are congruent when they belong to the same residue class.
a ≡ b (mod n) ⇔ n divides a−b
Example: 23 ≡ 3 (mod 10), because 23−3=20.
Why does it work?
If a−b=kn, then a and b differ by k complete turns of size n.
Step 3 / 15
Calculating a remainder, even for negatives
Use Euclidean division and always choose a nonnegative remainder.
a=nq+r, 0≤r<n
Example: −17=5×(−4)+3, so −17 mod 5=3.
Why does it work?
The quotient can be negative; the condition 0≤r<n makes the remainder unique. Modulo 1, it is always 0.
Step 4 / 15
Sums and differences
We may reduce each term before adding or subtracting.
a≡b, c≡d ⇒ a±c≡b±d (mod n)
Example: 17+29 ≡ 5+5 ≡ 10 (mod 12).
Why does it work?
The sum or difference of multiples of n is again a multiple of n.
Step 5 / 15
Products
Multiplication also preserves congruence.
a≡b, c≡d ⇒ ac≡bd (mod n)
Example: 123×456 mod 7 = 4×1 mod 7 = 4.
Why does it work?
If a=b+kn and c=d+hn, the difference ac−bd contains n as a factor.
Step 6 / 15
Powers and periodicity
Powers visit finitely many residues, so eventually a residue repeats.
7¹,7²,7³,7⁴ ≡ 7,9,3,1 (mod 10)
Example: 2026 mod 4=2, so the last digit of 7^2026 is 9.
Why does it work?
Once a state repeats, multiplication by the same base reproduces the path. Some cycles have a preperiod.
Step 7 / 15
Last digit
The last decimal digit is simply the residue modulo 10.
last digit of a^b = a^b mod 10
Example: 3^25: cycle 3,9,7,1; 25 mod 4=1, so the digit is 3.
Why does it work?
Two integers have the same last digit exactly when they are congruent modulo 10.
Step 8 / 15
Last two digits
Use modulo 100 for the last two digits and always write two characters.
last two digits of a^b = a^b mod 100
Example: 3^100 mod 100=1, so the last two digits are 01.
Why does it work?
Repeated squaring avoids constructing the enormous power.
Step 9 / 15
Divisibility
Each decimal place is a power of 10; replace 10 with its residue.
10≡1 (mod 9); 10≡−1 (mod 11)
Example: For 5724 the digit sum is 18, so it is divisible by 9. For 11, 2728 gives 2−7+2−8=−11, so it is divisible by 11.
Why does it work?
Modulo 9 every power of 10 is 1; modulo 11 they alternate between 1 and −1.
Step 10 / 15
Clocks and calendars
Hours cycle modulo 12 or 24; weekdays cycle modulo 7.
22+17≡15 (mod 24); 100≡2 (mod 7)
Example: One hundred days after Monday is Wednesday.
Why does it work?
Each full cycle returns the indicator to its starting position.
Step 11 / 15
Linear congruences
The equation ax≡b (mod n) may have no solution, one solution or several.
d=GCD(a,n); solutions exist ⇔ d divides b
Example: 6x≡4 (mod 8): d=2 and the solutions are 2 and 6.
Why does it work?
Divide by d to get one solution modulo n/d; this yields d classes modulo n.
Step 12 / 15
Modular inverse
The inverse of a is a number whose product with a has residue 1.
a⁻¹ exists (mod n) ⇔ GCD(a,n)=1, n>1
Example: 7×3=21≡1 (mod 10), hence 7⁻¹≡3.
Why does it work?
Bézout’s identity expresses 1 as a combination of a and n exactly when their GCD is 1.
Step 13 / 15
Systems of congruences
Find one integer satisfying several remainder conditions at once.
x≡2 (mod 3); x≡3 (mod 5)
Example: The smallest positive solution is x=8.
Why does it work?
From the first condition x=2+3t; substituting into the second gives t≡2 (mod 5).
Step 14 / 15
Chinese remainder theorem
With pairwise coprime moduli there is one solution class modulo their product.
Can an integer x satisfy x²≡3 (mod 4)? Answer yes or no.
Try the four residues 0,1,2,3.
Show solution: Their squares modulo 4 are 0,1,0,1. Remainder 3 is impossible: no.
23 / 25 · Challenge
Cubes modulo 9
Which distinct residues can x³ have modulo 9? Separate them with commas.
Try x=0,1,…,8.
Show solution: The cubes give 0,1,8,0,1,8,0,1,8. The distinct residues are {0,1,8}.
24 / 25 · Challenge
Three consecutive integers
Explain why n³−n is divisible by 6 for every integer n.
Factor n³−n=n(n−1)(n+1).
Show solution: These are three consecutive integers: one is divisible by 3 and at least one is even. Their product is divisible by 6, or n³≡n (mod 6).
25 / 25 · Challenge
A modulus inside another
Find the last digit of 7^(7^7).
Powers of 7 modulo 10 have period 4: first reduce 7^7 modulo 4.
Show solution: 7≡3 (mod 4), so 7^7≡3^7≡3 (mod 4). Position 3 in the cycle 7,9,3,1 gives 3.
Chinese remainder puzzles: 30 challenges
From coins and soldiers to calendars: solve systems of congruences, check the bounds, and discover when no answer exists. Solutions sit below each problem but stay closed until you choose to look.
The classical problem in the Sunzi Suanjing asks for a number leaving remainders 2, 3 and 2 on division by 3, 5 and 7. The blocks 70, 21 and 15 give 2×70 + 3×21 + 2×15 = 233; subtracting 105 twice gives 23.
Beginner
1 / 30 · Beginner
Three simple remainders
Find the smallest positive integer satisfying every condition.
x ≡ 1 (mod 3) · x ≡ 2 (mod 5) · x ≡ 3 (mod 7)
Hint
Combine the congruences one at a time: write x as the first remainder plus a multiple of the first modulus.
Show solution
2 / 30 · Beginner
Equal remainders
Find the smallest positive integer satisfying every condition.
x ≡ 2 (mod 3) · x ≡ 2 (mod 5) · x ≡ 2 (mod 7)
Hint
If all the remainders match, subtract that remainder and look for a multiple of the LCM.
Show solution
3 / 30 · Beginner
Almost a multiple
Find the smallest positive integer satisfying every condition.
x ≡ 2 (mod 3) · x ≡ 4 (mod 5) · x ≡ 6 (mod 7)
Hint
Each remainder is one less than its modulus: reason about x+1.
Show solution
4 / 30 · Beginner
Two congruences
Find the smallest positive integer satisfying every condition.
x ≡ 2 (mod 5) · x ≡ 3 (mod 7)
Hint
Combine the congruences one at a time: write x as the first remainder plus a multiple of the first modulus.
Show solution
5 / 30 · Beginner
A mysterious number
Find the smallest positive integer satisfying every condition.
x ≡ 1 (mod 4) · x ≡ 2 (mod 5) · x ≡ 3 (mod 7)
Hint
Combine the congruences one at a time: write x as the first remainder plus a multiple of the first modulus.
Show solution
7 / 30 · Beginner
The merchant’s coins
A merchant groups coins in threes, fives and sevens; 2, 4 and 6 coins remain. What is the smallest total?
x ≡ 2 (mod 3) · x ≡ 4 (mod 5) · x ≡ 6 (mod 7)
Hint
Each remainder is one less than its modulus: reason about x+1.
Show solution
16 / 30 · Beginner
Bags of rice
A merchant groups bags of rice in fours, fives or sixes; each time one fewer bag remains than the group size.
x ≡ 3 (mod 4) · x ≡ 4 (mod 5) · x ≡ 5 (mod 6)
Hint
Each remainder is one less than its modulus: reason about x+1.
Show solution
Intermediate
6 / 30 · Intermediate
Increasing remainders
Find the smallest positive integer satisfying every condition.
x ≡ 1 (mod 5) · x ≡ 2 (mod 7) · x ≡ 3 (mod 8)
Hint
Combine the congruences one at a time: write x as the first remainder plus a multiple of the first modulus.
Show solution
8 / 30 · Intermediate
The general’s soldiers
A general arranges soldiers in rows of 4, 5 and 7; respectively 1, 2 and 4 soldiers are left over.
x ≡ 1 (mod 4) · x ≡ 2 (mod 5) · x ≡ 4 (mod 7)
Hint
Combine the congruences one at a time: write x as the first remainder plus a multiple of the first modulus.
Show solution
10 / 30 · Intermediate
Just before a multiple
Find the smallest positive integer satisfying every condition.
x ≡ 3 (mod 5) · x ≡ 4 (mod 7) · x ≡ 5 (mod 9)
Hint
Combine the congruences one at a time: write x as the first remainder plus a multiple of the first modulus.
Show solution
11 / 30 · Intermediate
Four conditions
Find the smallest positive integer satisfying every condition.
x ≡ 1 (mod 2) · x ≡ 2 (mod 3) · x ≡ 3 (mod 5) · x ≡ 4 (mod 7)
Hint
Combine the congruences one at a time: write x as the first remainder plus a multiple of the first modulus.
Show solution
13 / 30 · Intermediate
Reverse problem
What remainders does 47 leave when divided by 3, 5 and 7? Enter the three remainders in order, separated by commas.
47 mod 3, 5, 7
Hint
Divide 47 by each modulus and write down the three remainders in order.
Show solution
17 / 30 · Intermediate
Rows of soldiers
Rows of 5, 7 or 8 soldiers leave respectively 1, 3 or 4 soldiers outside.
x ≡ 1 (mod 5) · x ≡ 3 (mod 7) · x ≡ 4 (mod 8)
Hint
Combine the congruences one at a time: write x as the first remainder plus a multiple of the first modulus.
Show solution
19 / 30 · Intermediate
The hidden number
Find the smallest positive integer satisfying every condition.
x ≡ 1 (mod 6) · x ≡ 2 (mod 7) · x ≡ 3 (mod 8)
Hint
Combine the congruences one at a time: write x as the first remainder plus a multiple of the first modulus.
Show solution
20 / 30 · Intermediate
The mysterious calendar
Three periodic events repeat every 5, 7 and 9 days. Their next occurrences are in 1, 3 and 4 days. When will all three occur together?
x ≡ 1 (mod 5) · x ≡ 3 (mod 7) · x ≡ 4 (mod 9)
Hint
Combine the congruences one at a time: write x as the first remainder plus a multiple of the first modulus.
Show solution
21 / 30 · Intermediate
Water containers
Pouring a whole number of litres into containers of 8, 9 or 13 litres leaves 3, 5 or 7 litres.
x ≡ 3 (mod 8) · x ≡ 5 (mod 9) · x ≡ 7 (mod 13)
Hint
Combine the congruences one at a time: write x as the first remainder plus a multiple of the first modulus.
Show solution
22 / 30 · Intermediate
Compatibility
Find the smallest positive integer satisfying every condition.
x ≡ 2 (mod 6) · x ≡ 5 (mod 9)
Hint
For moduli that are not coprime, their remainders must agree modulo their GCD.
Show solution
25 / 30 · Intermediate
Almost consecutive
Find the smallest positive integer satisfying every condition.
x ≡ 1 (mod 5) · x ≡ 2 (mod 6) · x ≡ 3 (mod 7)
Hint
Combine the congruences one at a time: write x as the first remainder plus a multiple of the first modulus.
Show solution
Advanced
9 / 30 · Advanced
Three coprime moduli
Find the smallest positive integer satisfying every condition.
x ≡ 3 (mod 8) · x ≡ 5 (mod 9) · x ≡ 7 (mod 11)
Hint
Combine the congruences one at a time: write x as the first remainder plus a multiple of the first modulus.
Show solution
12 / 30 · Advanced
Composite moduli
Find the smallest positive integer satisfying every condition.
x ≡ 5 (mod 8) · x ≡ 7 (mod 9) · x ≡ 9 (mod 11)
Hint
Combine the congruences one at a time: write x as the first remainder plus a multiple of the first modulus.
Show solution
15 / 30 · Advanced
A higher level
Find the smallest positive integer satisfying every condition.
x ≡ 2 (mod 7) · x ≡ 4 (mod 9) · x ≡ 6 (mod 11)
Hint
Combine the congruences one at a time: write x as the first remainder plus a multiple of the first modulus.
Show solution
26 / 30 · Advanced
Between 100 and 500
The required number lies between 100 and 500 inclusive.
x ≡ 2 (mod 7) · x ≡ 3 (mod 8) · x ≡ 4 (mod 9)
Look for an answer within the stated bound; if none exists, write “none”. From 100 · Up to 500
Hint
Solve without bounds first; then compare the smallest positive candidate with the required interval.
Show solution
28 / 30 · Advanced
Four conditions together
Find the smallest positive integer satisfying every condition.
x ≡ 1 (mod 3) · x ≡ 2 (mod 4) · x ≡ 3 (mod 5) · x ≡ 4 (mod 7)
Hint
Combine the congruences one at a time: write x as the first remainder plus a multiple of the first modulus.
Show solution
30 / 30 · Advanced
The final challenge
Find the smallest positive integer satisfying every condition.
x ≡ 4 (mod 7) · x ≡ 5 (mod 8) · x ≡ 6 (mod 9) · x ≡ 7 (mod 11)
Hint
Combine the congruences one at a time: write x as the first remainder plus a multiple of the first modulus.
Show solution
Trick questions with no answer under the stated conditions
14 / 30 · Trick questions with no answer under the stated conditions
Does it exist?
Find the smallest positive integer satisfying every condition.
x ≡ 1 (mod 4) · x ≡ 2 (mod 6)
Hint
For moduli that are not coprime, their remainders must agree modulo their GCD.
Show solution
18 / 30 · Trick questions with no answer under the stated conditions
Treasure coins
A treasure holds fewer than 500 coins; division by 7, 9 and 11 leaves 2, 4 and 6.
x ≡ 2 (mod 7) · x ≡ 4 (mod 9) · x ≡ 6 (mod 11)
Look for an answer within the stated bound; if none exists, write “none”. Less than 500
Hint
Solve without bounds first; then compare the smallest positive candidate with the required interval.
Show solution
23 / 30 · Trick questions with no answer under the stated conditions
An impossible system
Find the smallest positive integer satisfying every condition.
x ≡ 2 (mod 6) · x ≡ 4 (mod 9)
Hint
For moduli that are not coprime, their remainders must agree modulo their GCD.
Show solution
24 / 30 · Trick questions with no answer under the stated conditions
The warehouse
A warehouse holds fewer than 1,000 boxes; grouping by 11, 13 and 17 leaves 4, 6 and 10.
x ≡ 4 (mod 11) · x ≡ 6 (mod 13) · x ≡ 10 (mod 17)
Look for an answer within the stated bound; if none exists, write “none”. Less than 1000
Hint
Solve without bounds first; then compare the smallest positive candidate with the required interval.
Show solution
27 / 30 · Trick questions with no answer under the stated conditions
Reconstruction from a clue
The required number lies between 200 and 400 inclusive.
x ≡ 1 (mod 7) · x ≡ 1 (mod 9) · x ≡ 1 (mod 11)
Look for an answer within the stated bound; if none exists, write “none”. From 200 · Up to 400
Hint
Solve without bounds first; then compare the smallest positive candidate with the required interval.
Show solution
29 / 30 · Trick questions with no answer under the stated conditions
The “half remainder”
Find the smallest positive integer satisfying every condition.
x ≡ 2 (mod 4) · x ≡ 3 (mod 6) · x ≡ 4 (mod 8)
Hint
For moduli that are not coprime, their remainders must agree modulo their GCD.
Show solution
Random practice
Each challenge is generated on the spot: the answer is computed, not taken from a fixed list.