Dirichlet's Theorem on Primes in Arithmetic Progressions
See why sequences like 4, 7 or 100 apart contain endless primes, with easy cases proved and the idea behind the full proof.
Key takeaways
- An arithmetic progression a, a + d, a + 2d, and so on, contains infinitely many primes when gcd(a, d) = 1.
- If a and d share a factor greater than 1, the progression contains at most one prime.
- The primes are shared equally, in the limit, among all the allowed remainder classes modulo d.
- Some special cases follow from Euclid-style arguments, but the general proof uses infinite series called L-functions.
- The key difficulty is showing that certain of those series do not equal zero at the point 1.
Dirichlet's theorem says that if you start at a whole number a and keep adding a step d, you will hit infinitely many primes, provided a and d share no common factor larger than 1. The sequence 3, 7, 11, 15, 19, ... contains endlessly many primes, and so does the sequence of numbers ending in the digits 123.
Peter Gustav Lejeune Dirichlet proved this in 1837. His method, which brought calculus to bear on questions about whole numbers, is often counted as the start of analytic number theory.
Setting up the statement
An arithmetic progression is a list with a constant difference. With first term a = 3 and difference d = 4 you get 3, 7, 11, 15, 19, 23, and so on. These are exactly the positive numbers that leave remainder 3 on division by 4.
The greatest common divisor, gcd(a, d), is the largest whole number dividing both. When it equals 1 the two are called coprime. The Euclidean algorithm computes it quickly.
Why is the coprime condition necessary? Suppose a = 6 and d = 9. Every term 6 + 9k is divisible by 3, so no term after possibly 3 itself can be prime. In general a common factor g of a and d divides every term.
Dirichlet's theorem says this obvious obstacle is the only one.
Looking at examples
Primes other than 2 and 5 must end in 1, 3, 7 or 9, because those are the digits coprime to 10.
ending in 1: 11, 31, 41, 61, 71, 101, ...
ending in 3: 3, 13, 23, 43, 53, 73, ...
ending in 7: 7, 17, 37, 47, 67, 97, ...
ending in 9: 19, 29, 59, 79, 89, 109, ... The theorem guarantees that each of these four lists goes on forever. It applies just as well to enormous steps: there are infinitely many primes ending in 999,999, since that number shares no factor with 1,000,000.
If you work with remainders often, modular arithmetic is the natural language: the theorem says each coprime residue class modulo d holds infinitely many primes.
An easy case: primes of the form 4k + 3
Some cases need only a twist on Euclid's proof. Suppose there were only finitely many primes leaving remainder 3 modulo 4. Multiply all of them together, call the product P, and look at N = 4P − 1.
First, N leaves remainder 3 modulo 4 and is odd. So its prime factors each leave remainder 1 or 3. A product of numbers that all leave remainder 1 also leaves remainder 1. Therefore at least one prime factor q of N leaves remainder 3.
Second, q cannot be on your list. Every listed prime divides 4P, so it cannot also divide 4P − 1. This contradicts the assumption that the list was complete.
suppose the list is 3, 7, 11
P = 231, N = 4 × 231 − 1 = 923 = 13 × 71
71 = 4 × 17 + 3, a new prime of the required form The other case: 4k + 1
The same trick fails here, because two factors of remainder 3 multiply to give remainder 1. You need a deeper fact: if an odd prime q divides x² + 1, then q leaves remainder 1 modulo 4. It follows from the theory of quadratic residues.
With a supposed complete list, let P be its product and set N = (2P)² + 1. Every prime factor of N has the required form, and none can be on the list, since each listed prime divides 2P.
Arguments of this sort work for a number of other progressions, but not for all. It has been shown that a certain natural style of Euclidean proof is only possible when a² leaves remainder 1 modulo d. The general case needed a new idea.
Dirichlet's idea
Euler had noticed that the sum 1/2 + 1/3 + 1/5 + 1/7 + ... over all primes grows without bound, which gives another proof that there are infinitely many. It comes from the Euler product. Dirichlet wanted the same for the primes in just one progression.
To filter out one class he invented characters. A character modulo d assigns a number to each integer, depending only on its remainder, in a way that respects multiplication, and gives 0 when the integer shares a factor with d.
Modulo 4 there are two. One assigns 1 to every odd number. The other, call it χ, assigns 1 to numbers of the form 4k + 1, −1 to numbers of the form 4k + 3 and 0 to even numbers. Adding or subtracting the two picks out either class.
Each character gives a series, called an L-function.
L(s, χ) = χ(1)/1ˢ + χ(2)/2ˢ + χ(3)/3ˢ + ...
L(1, χ) = 1 − 1/3 + 1/5 − 1/7 + ... = π/4 The heart of the proof is that L(1, χ) is not zero for any character other than the all-ones kind. Then the all-ones character drives the sum over primes in each class to infinity, and the others cannot cancel it. For the example modulo 4 the value π/4 is visibly nonzero. Showing it in general is the hard step.
Characters as filters, worked through
The filtering step is easier to trust once you see it on numbers. Modulo 4, call the all-ones character χ₀. It gives 1 to odd numbers and 0 to even ones. Average it with χ.
| n | χ₀(n) | χ(n) | (χ₀ + χ) / 2 | (χ₀ − χ) / 2 |
|---|---|---|---|---|
| 5 | 1 | 1 | 1 | 0 |
| 7 | 1 | −1 | 0 | 1 |
| 8 | 0 | 0 | 0 | 0 |
| 11 | 1 | −1 | 0 | 1 |
| 13 | 1 | 1 | 1 | 0 |
The fourth column is a switch that is on exactly for remainder 1, and the fifth is on exactly for remainder 3. Any sum over primes in one class can therefore be rewritten as a mixture of sums involving characters.
Why bother, if the switch is already clear? Because characters are multiplicative: χ(m × n) = χ(m) × χ(n). That property lets each series L(s, χ) be written as a product over primes, which links it to prime sums. The raw on-off switch is not multiplicative, since 3 × 7 leaves remainder 1 although neither factor does.
For a general modulus d, there are exactly φ(d) characters, and their values may be complex numbers. Modulo 5, for example, one character sends 1, 2, 4 and 3 to 1, i, −1 and −i. The same averaging trick, with complex conjugates as weights, isolates any chosen coprime class.
Why the nonvanishing step is delicate
For characters that take genuinely complex values, a fairly short argument shows that L(1, χ) cannot be zero, because zeros would have to come in pairs and two would be too many. The hard case is a character with only real values, 1, −1 and 0.
Dirichlet handled that case with a remarkable detour. He connected L(1, χ) to a count of classes of quadratic forms, expressions such as ax² + bxy + cy². The relationship is now called the class number formula. A class number counts something that exists, so it is at least 1, and the value of the series cannot vanish. Later authors found other proofs, some quite short, using complex analysis.
Equal shares
A sharper version, which came with the methods used for the prime number theorem, says the primes divide evenly. The number of coprime classes modulo d is Euler's function φ(d), discussed in Euler's theorem and the totient. Each class receives, in the limit, a fraction 1/φ(d) of all primes.
For d = 10 that is a quarter for each final digit. For d = 4 it is half and half. Count the odd primes up to 100.
| class | primes up to 100 | count |
|---|---|---|
| 4k + 1 | 5, 13, 17, 29, 37, 41, 53, 61, 73, 89, 97 | 11 |
| 4k + 3 | 3, 7, 11, 19, 23, 31, 43, 47, 59, 67, 71, 79, 83 | 13 |
The class 4k + 3 is slightly ahead, and it tends to stay ahead for long stretches. This is called Chebyshev's bias. It is consistent with the theorem, because the lead is tiny compared with the totals, and the lead does change hands now and then.
How soon does the first prime appear?
The theorem promises infinitely many primes but is silent about where the first one is. Yuri Linnik proved in the 1940s that the smallest prime in an allowed progression modulo d is at most a constant times d raised to some fixed power. Later work has reduced the power considerably. The truth is expected to be only a little larger than d.
Sharper estimates about how evenly primes fill the classes depend on the generalized Riemann hypothesis, which remains unproved as of the mid-2020s.
A related but different result
Do not confuse Dirichlet's theorem with the Green-Tao theorem of 2004. Dirichlet fixes a progression and finds infinitely many primes scattered along it. Ben Green and Terence Tao showed that the primes contain arbitrarily long unbroken progressions.
5, 11, 17, 23, 29 step 6, five primes in a row
7, 37, 67, 97, 127, 157 step 30, six primes in a row The second example ends there, because the next term, 187, equals 11 × 17. No infinite progression can consist only of primes: with first term a greater than 1, the term a + a × d is divisible by a.
Common questions
Does the theorem help find large primes?
It guarantees supply. Programs that need a prime of a special form, say one more than a multiple of a large power of 2, search along that progression and expect success after a modest number of tries.
Why is gcd the only condition?
Primes avoid a class only when divisibility forces them to. The proof shows that no hidden, subtler bias can empty a class.