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.2023 AMC 10B #8
What is the units digit of ?
- A)
- B)
- C)
- D)
- E)
- 2.2012 AMC 10B #4
When Ringo places his marbles into bags with 6 marbles per bag, he has 4 marbles left over. When Paul does the same with his marbles, he has 3 marbles left over. Ringo and Paul pool their marbles and place them into as many bags as possible, with 6 marbles per bag. How many marbles will be left over?
- A)
- B)
- C)
- D)
- E)
- 3.2025 AMC 10B #2
Jerry wrote down the ones digit of each of the first positive squares: . What is the sum of all the numbers Jerry wrote down?
- A)
- B)
- C)
- D)
- E)
- 4.2024 AMC 10B #7
What is the remainder when is divided by ?
- A)
- B)
- C)
- D)
- E)
- 5.2023 AMC 10B #6
Let , , and for . How many terms in the sequence are even?
- A)
- B)
- C)
- D)
- E)
- 6.2021 AMC Fall 10A #12
The base-nine representation of the number is What is the remainder when is divided by
- A)
- B)
- C)
- D)
- E)
- 7.2017 AMC 10A #13
Define a sequence recursively by and the remainder when is divided by for all Thus the sequence starts What is
- A)
- B)
- C)
- D)
- E)
- 8.2016 AMC 10B #8
What is the tens digit of
- A)
- B)
- C)
- D)
- E)
- 9.2015 AMC 10B #10
What is the sign and units digit of the product of all the odd negative integers strictly greater than ?
- A)
- B)
- C)
- D)
- E)
- 10.2009 AMC 10B #13
As shown below, convex pentagon has sides , , , , and . The pentagon is originally positioned in the plane with vertex at the origin and vertex on the positive -axis. The pentagon is then rolled clockwise to the right along the -axis. Which side will touch the point on the -axis?

- A)
- B)
- C)
- D)
- E)
- 11.2007 AMC 10B #9
A cryptographic code is designed as follows. The first time a letter appears in a given message it is replaced by the letter that is place to its right in the alphabet (asumming that the letter is one place to the right of the letter ). The second time this same letter appears in the given message, it is replaced by the letter that is places to the right, the third time it is replaced by the letter that is places to the right, and so on. For example, with this code the word "banana" becomes "cbodqg". What letter will replace the last letter in the message
- A)
- B)
- C)
- D)
- E)
- 12.2006 AMC 10B #11
What is the tens digit in the sum
- A)
- B)
- C)
- D)
- E)
- 13.2003 AMC 10A #16
What is the units digit of ?
- A)
- B)
- C)
- D)
- E)
- 14.2000 AMC 10 #6
The Fibonacci sequence starts with two 1s, and each term afterwards is the sum of its two predecessors. Which one of the ten digits is the last to appear in the units position of a number in the Fibonacci sequence?
- A)
- B)
- C)
- D)
- E)
- 15.2022 AMC 10B #17
One of the following numbers is not divisible by any prime number less than Which is it?
- A)
- B)
- C)
- D)
- E)
- 16.2020 AMC 10B #15
Steve wrote the digits , , , , and in order repeatedly from left to right, forming a list of digits, beginning He then erased every third digit from his list (that is, the rd, th, th, digits from the left), then erased every fourth digit from the resulting list (that is, the th, th, th, digits from the left in what remained), and then erased every fifth digit from what remained at that point. What is the sum of the three digits that were then in the positions ?
- A)
- B)
- C)
- D)
- E)
- 17.2018 AMC 10B #16
Let be a strictly increasing sequence of positive integers such that What is the remainder when is divided by ?
- A)
- B)
- C)
- D)
- E)
- 18.2018 AMC 10B #13
How many of the first numbers in the sequence are divisible by ?
- A)
- B)
- C)
- D)
- E)
- 19.2018 AMC 10A #19
A number is randomly selected from the set , and a number is randomly selected from . What is the probability that has a units digit of ?
- A)
- B)
- C)
- D)
- E)
- 20.2017 AMC 10B #14
An integer is selected at random in the range . What is the probability that the remainder when is divided by 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.