Modular Arithmetic
Remainders, congruences, last digits, cyclicity, Chinese-remainder style reasoning
What you need to know
- What "mod" means. means and leave the same remainder when divided by ; in other words, divides . Example: , since divides .
- Working with remainders. You can add, subtract, and multiply congruences, swapping any number for its remainder. You may divide both sides by only when shares no factor with . Example: . But while : dividing by failed.
- Units digits cycle. The units digits of repeat with a cycle length that divides . Example: powers of end in ; since , ends in .
- Any modulus. The remainders of mod always start repeating at some point, so once inside the cycle, reduce the exponent by the cycle length. A few powers may come before the cycle starts. Example: mod , powers of go ; the cycle starts at .
- Fermat's Little Theorem. If is prime and does not divide , then .
- Squares. A square leaves remainder or when divided by or by . Divided by , a square leaves , , or , and an odd square always leaves . Example: and .
- Chinese Remainder Theorem. If , a number's remainders mod and mod pin down its remainder mod . Example: remainder mod and mod means remainder mod .
- Digit shortcuts. A number and its digit sum agree mod . Mod , use the alternating digit sum, starting with on the units digit. Mod , keep the last two digits. Example: leaves mod (digit sum ), mod (), and mod .
How AMC 10 tests it
- "What is the units digit (or remainder mod ) of ?" Find the cycle and reduce the exponent (problems 8–15).
- Day-of-week or clock problems: count days, reduce mod or , watch leap years.
- "Find the smallest with , , ": the Chinese Remainder Theorem, by listing or stepping through multiples (problems 12–20).
- Showing an equation has no solutions by working mod , , , or .
- Divisibility in disguise, such as "the average was a whole number after each entry," which means the first entries add up to a multiple of .
Standard approaches
- Reduce the base first, find the cycle length of its powers, and reduce the exponent by that length (never by ).
- In sums of factorials or products, every term past some point is , so only the first few matter. Example: from on, factorials end in , so ends in the same digit as .
- For several congruences, start with the largest modulus and step through its numbers until the others hold. Example: above, gives , and already works.
- For "no integer solutions," use a modulus where squares or cubes have few remainders. Example: leaves , , or mod , so it never equals .
- Use negative remainders to make powers easy: , so .
Worked example
What is the remainder when is divided by ?
(A) (B) (C) (D) (E)
Step 1: the cycle. Multiply by and keep the remainder mod each time: , , , , , . The pattern repeats every powers.
Step 2: place . , so .
Step 3: add. , so . Then .
The answer is .
Pitfalls
- Reducing the exponent by instead of the cycle length. Example: using gives , which is wrong.
- Misplacing remainder : it means the end of the cycle. Example: , so is the th entry, , not the first entry, . Likewise ends in , the last of , not in .
- Dividing both sides by a number that shares a factor with the modulus (see the example above).
- Off-by-one errors in calendar problems: counting the starting day, or February in leap years. Example: days after a Monday is a Thursday (), not a Wednesday.
Traps that recur
- Assuming the bits repeat 111 or 011 from the first few (x₀ = x₁ = x₂ = 1) without computing far enough to see the period-3 pattern 0,1,1. (2022 AMC 10B #25)
- Reducing 90! mod 100 directly (it is 0) or forgetting that removing 21 factors of 5 also requires removing exactly 21 factors of 2. (2010 AMC 10A #24)
- Assuming powers spread out over many residues (answering 25 or 125) instead of testing whether 100 is a multiple of the order of every unit mod 125. (2024 AMC 10B #18)
- Testing only whether each fraction is an integer separately; for odd m none of them is, yet the fractional parts 1/2 + 1/4 + 1/8 + 1/8 add up to exactly 1. (2024 AMC 10B #24)
- 1.2010 AMC 10B #18
Positive integers , , and are randomly and independently selected with replacement from the set . What is the probability that is divisible by ?
- A)
- B)
- C)
- D)
- E)
- 2.2009 AMC 10B #21
What is the remainder when is divided by 8?
- A)
- B)
- C)
- D)
- E)
- 3.2006 AMC 10A #20
Six distinct positive integers are randomly chosen between and , inclusive. What is the probability that some pair of these integers has a difference that is a multiple of ?
- A)
- B)
- C)
- D)
- E)
- 4.2004 AMC 10B #13
In the United States, coins have the following thicknesses: penny, mm; nickel, mm; dime, mm; quarter, mm. If a stack of these coins is exactly mm high, how many coins are in the stack?
- A)
- B)
- C)
- D)
- E)
- 5.2000 AMC 10 #14
Mrs. Walter gave an exam in a mathematics class of five students. She entered the scores in random order into a spreadsheet, which recalculated the class average after each score was entered. Mrs. Walter noticed that after each score was entered, the average was always an integer. The scores (listed in ascending order) were , , , , and . What was the last score Mrs. Walters entered?
- A)
- B)
- C)
- D)
- E)
- 6.2000 AMC 10 #17
Boris has an incredible coin-changing machine. When he puts in a quarter, it returns five nickels; when he puts in a nickel, it returns five pennies; and when he puts in a penny, it returns five quarters. Boris starts with just one penny. Which of the following amounts could Boris have after using the machine repeatedly?
- A)$3.63
- B)$5.13
- C)$6.30
- D)$7.45
- E)$9.07
- 7.2024 AMC 10B #24
Let How many of the values , , , and are integers?
- A)
- B)
- C)
- D)
- E)
- 8.2024 AMC 10B #18
How many different remainders can result when the th power of an integer is divided by ?
- A)
- B)
- C)
- D)
- E)
- 9.2022 AMC 10A #19
Define as the least common multiple of all the integers from to inclusive. There is a unique integer such that What is the remainder when is divided by ?
- A)
- B)
- C)
- D)
- E)
- 10.2021 AMC Fall 10B #22
For each integer , let be the sum of all products , where and are integers and . What is the sum of the 10 least values of such that is divisible by ?
- A)
- B)
- C)
- D)
- E)
- 11.2017 AMC 10B #23
Let be the -digit number that is formed by writing the integers from to in order, one after the other. What is the remainder when is divided by ?
- A)
- B)
- C)
- D)
- E)
- 12.2017 AMC 10B #25
Last year Isabella took math tests and received different scores, each an integer between and , inclusive. After each test she noticed that the average of her test scores was an integer. Her score on the seventh test was . What was her score on the sixth test?
- A)
- B)
- C)
- D)
- E)
- 13.2011 AMC 10B #23
What is the hundreds digit of ?
- A)
- B)
- C)
- D)
- E)
- 14.2008 AMC 10A #24
Let . What is the units digit of ?
- A)
- B)
- C)
- D)
- E)
- 15.2003 AMC 10A #25
Let be a -digit number, and let and be the quotient and the remainder, respectively, when is divided by . For how many values of is divisible by ?
- A)
- B)
- C)
- D)
- E)
- 16.2003 AMC 10B #25
How many distinct four-digit numbers are divisible by and have as their last two digits?
- A)
- B)
- C)
- D)
- E)
- 17.2022 AMC 10B #25
Let be a sequence of numbers, where each is either or . For each positive integer , define Suppose for all . What is the value of the sum
- A)
- B)
- C)
- D)
- E)
- 18.2010 AMC 10A #24
The number obtained from the last two nonzero digits of is equal to . What is ?
- A)
- B)
- C)
- D)
- E)
Problems © Mathematical Association of America (MAA), American Mathematics Competitions. Reproduced for non-commercial educational use. The topic note, tags and key insights are original to this site.