Topics / Number Theory
Modular Arithmetic
Remainders, congruences, last digits, cyclicity, Chinese-remainder style reasoning
What you need to know
- means . Congruences can be added, subtracted, and multiplied; you may divide by only when .
- Powers cycle: the units digits of repeat with period dividing ; in general is eventually periodic, so reduce the exponent modulo the period.
- Fermat's little theorem: if is prime and , then .
- Squares are and ; every square is , and every odd square is .
- Chinese Remainder Theorem: if , a residue mod and a residue mod determine a unique residue mod .
- ; ; is the last two digits.
How AMC 10 tests it
- "What is the units digit (or remainder mod ) of ?" Find the cycle, reduce the exponent (problems 8–15).
- Day-of-week or clock problems: count days, reduce mod or , watch leap years.
- "Find the smallest with , , ": CRT by listing or by stepping through multiples (problems 12–20).
- Impossibility proofs: show an equation has no solutions by reducing mod , , , or .
- Disguised divisibility, such as "the average was an integer after each entry" meaning partial sums are divisible by their length.
Standard approaches
- Reduce the base first, then find the period of the powers and reduce the exponent modulo that period (never modulo ).
- For sums of factorials or products, note that all terms beyond a point are ; only the first few matter.
- For simultaneous congruences, satisfy the largest modulus, then step by it until the next condition holds.
- For "no integer solutions," pick a modulus where squares or cubes take few values.
- Use negative residues ( instead of ) to make powers trivial: .
Worked example
What is the remainder when is divided by ?
(A) (B) (C) (D) (E)
Powers of modulo : , then repeat with period . Since , we have . Next, , so . Adding, . The answer is .
Pitfalls
- Reducing the exponent modulo instead of modulo the period of the cycle.
- Treating remainder as "cycle position ": corresponds to position , i.e., , not .
- Dividing both sides of a congruence by a number sharing a factor with the modulus.
- Off-by-one errors in calendar problems (counting the starting day, February in leap years).
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)
Problems, easiest first
What is the units digit of ?
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?
Jerry wrote down the ones digit of each of the first positive squares: . What is the sum of all the numbers Jerry wrote down?
What is the remainder when is divided by ?
Let , , and for . How many terms in the sequence are even?
The base-nine representation of the number is What is the remainder when is divided by
Define a sequence recursively by and the remainder when is divided by for all Thus the sequence starts What is
What is the tens digit of
What is the sign and units digit of the product of all the odd negative integers strictly greater than ?
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 …
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 …
What is the tens digit in the sum
What is the units digit of ?
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?
One of the following numbers is not divisible by any prime number less than Which is it?
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 …
Let be a strictly increasing sequence of positive integers such that What is the remainder when is divided by ?
How many of the first numbers in the sequence are divisible by ?
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 ?
An integer is selected at random in the range . What is the probability that the remainder when is divided by is ?
Positive integers , , and are randomly and independently selected with replacement from the set . What is the probability that is divisible by ?
What is the remainder when is divided by 8?
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 ?
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?
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) …
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 …
How many different remainders can result when the th power of an integer is divided by ?
Let How many of the values , , , and are integers?
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 ?
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 ?
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 ?
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?
What is the hundreds digit of ?
Let . What is the units digit of ?
How many distinct four-digit numbers are divisible by and have as their last two digits?
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 ?
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
The number obtained from the last two nonzero digits of is equal to . What is ?