Definition 24.0.1 · Congruence
means that the number leaves the same remainder as when divided by . Equivalently, divides . Read it as “ is congruent to mod ”.
Work with remainders instead of huge numbers: wrap around a clock, spot digit cycles, and use Euler, Fermat, Wilson and the Chinese Remainder Theorem to tame enormous powers.
In this section you will be able to replace big numbers by their remainders, use negative remainders, and find the cycle of a power.
Multiply all the way to a number with 999 nines. The last three digits? Every factor after the second is mod .
Modular arithmetic only keeps the remainder. Think of a clock with spots: on a 6-hour clock is the same spot as .
Look: you can swap any number for its remainder before you add, multiply or take powers. The answer lands on the same spot. A negative name often helps: .
means that the number leaves the same remainder as when divided by . Equivalently, divides . Read it as “ is congruent to mod ”.
If and , then
(The book prints the first congruence as “”; it means .)
Write and . Then , so is a multiple of . The same argument works for .
If , then
for every positive integer .
Apply Theorem 24.0.2 to ( factors), replacing each by .
To find the last digit(s) of a huge power , compute the first few values of and look for a pattern. The remainders must eventually repeat, so the pattern carries over to large .
Find the remainder when is divided by .
By Theorem 24.0.2 you may replace every factor by its remainder mod . What is mod , written as a negative number?
Let be a subset of with the property that no pair of distinct elements in has a sum divisible by . What is the largest possible size of ?
Whether a sum is divisible by depends only on the remainders. Sort by remainder mod . How many numbers land in each class?
Find the remainder when is divided by .
Find the remainder when is divided by .
What is the remainder when is divided by ?
How many of the first numbers in the sequence are divisible by ?
How many distinct four-digit numbers are divisible by and have as their last two digits?
In this section you will be able to count with Euler's φ, shrink huge exponents with Euler and Fermat, find inverses, and use Wilson and the binomial theorem.
What is mod ? Powers of mod repeat, and the cycle length divides . So is really .
counts the numbers from to that share no factor with . Strike out the multiples of each prime factor and count what is left.
Look: when , . So you can cut any exponent down mod . For a prime this is Fermat: .
If has the prime factorization , then
where is the number of positive integers that are relatively prime to .
Steps: 1. Find the prime factorization of . 2. For each prime , form and multiply them. 3. Multiply that product by .
Striking the multiples of removes exactly of . Among the survivors, the multiples of are again exactly of them (the survivors repeat in blocks of , and is coprime to ). Keep going: each prime keeps the fraction of what is left.
For ,
if and only if .
If is a prime and , then
(The book says “if and only if is a prime and ”. The converse is false: is not prime, yet for every coprime to .)
Take in Euler's theorem: , and exactly when .
If , then is the modular inverse of (mod ), and is the inverse of . We write
An inverse of exists exactly when .
For a prime ,
Every number pairs with its inverse. Only and are their own inverses ( means ). The pairs multiply to , leaving .
For non-negative ,
In modular arithmetic, write a big base as “small number + multiple of 10”: in every term from on vanishes mod , so .
Let . Determine the remainder upon dividing by .
Euler's theorem needs . What is it?
What is the hundreds digit of ?
Only the last three digits matter, so work mod . What is ?
Find the remainder when is divided by .
An integer is selected at random in the range . What is the probability that the remainder when is divided by is ?
Let be a strictly increasing sequence of positive integers such that
What is the remainder when is divided by ?
The number obtained from the last two nonzero digits of is equal to . What is ?
In this section you will be able to solve systems of congruences with the Chinese Remainder Theorem, by guess and check or by algebra.
Find a number above that leaves remainder when divided by and remainder when divided by . Guessing works, but there is a faster way.
Each congruence picks out every -th number. When the moduli share no factor, the two patterns line up exactly once in every numbers. That is the Chinese Remainder Theorem.
Look: to solve it by algebra, write and put that into the second congruence. You only need one inverse.
If a positive number satisfies
where the are pairwise relatively prime, then has a unique solution modulo .
Be careful! This may fail if some share a common factor: the congruences might contradict each other. For example, says is odd, while says is even.
To solve a pair of congruences you can either guess and check until a number satisfies both, or use the algebraic method:
(The book's step 3 reads “”, and step 5 uses undefined letters ; fixed here.)
For relatively prime , the solution of and is
(The book leaves out the final modulus .)
To solve more than two congruences, solve them two at a time until only one congruence is left.
Find the smallest positive integer greater than that leaves a remainder of when divided by and leaves a remainder of when divided by .
Write . The second condition says . So (use a remainder from to )
The positive integers and both end in the same sequence of four digits when written in base , where digit is not zero. Find the three-digit number .
Write the condition as a congruence. What must be divisible by?
Find the smallest positive number that leaves a remainder of when divided by and a remainder of when divided by .
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 the set of all integers such that for all pairs of nonnegative integers with , the remainder when is divided by is less than the remainder when is divided by . What is the sum of the elements of ?
In this section you will be able to mix every tool of the chapter on contest problems.
The rest of the practice set, from AMC 10 warm-ups to AIME 13s. First ask: which modulus makes the problem small?
If , and are primes with , find .
This problem also appears in the book as 21.3.21.
What is the hundreds digit of ?
This problem also appears in the book as 21.3.19.
What is the tens digit of ?
Which of the following expressions is never a prime number when is a prime number?
Let equal the sum of the digits of positive integer . For example, . For a particular positive integer , . Which of the following could be the value of ?
This problem also appears in the book as 21.3.20.
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 ?
One of the following numbers is not divisible by any prime number less than . Which is it?
Let be the least prime number for which there exists a positive integer such that is divisible by . Find the least positive integer such that 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
What is the greatest power of that is a factor of ?
For positive integers and , define to be -nice if there exists a positive integer such that has exactly positive divisors. Find the number of positive integers less than that are neither -nice nor -nice.
Let be the set of integers between and whose binary expansions have exactly two 's. If a number is chosen at random from , the probability that it is divisible by is , where and are relatively prime positive integers. Find .
It is known that, for all positive integers ,
Find the smallest positive integer such that is a multiple of .
Find the sum of all positive integers such that when is divided by , the remainder is .