Primes in Arithmetic Progressions
Dirichlet's
theorem tells us that whenever \gcd(a,q)=1, the progression
a, a+q, a+2q, \dots contains infinitely many primes. That is a
yes/no answer to a counting question. But it leaves the sharper, more human question wide open:
how many? If you split the primes up to a million by their remainder mod
10, do the four allowed endings — 1, 3, 7, 9 —
get roughly a quarter each, or does one ending hog the primes and starve the others?
The answer is one of the most satisfying facts in analytic number theory: the primes are
equidistributed. Each of the \varphi(q) admissible classes
gets, asymptotically, the same share — 1/\varphi(q) of all the
primes. This is the Prime Number Theorem for arithmetic progressions (PNT for APs),
the quantitative refinement of Dirichlet, and this page is about what it says, why it is true, and the
deep subtlety hiding in its error term.
From "infinitely many" to "how many"
Write \pi(x;q,a) for the number of primes
p \le x with p \equiv a \pmod q. The ordinary
Prime Number
Theorem says \pi(x) \sim x/\log x. PNT for APs says those primes
are shared out evenly among the \varphi(q) classes coprime to
q.
Fix q \ge 1 and a with
\gcd(a,q)=1. Then, as x \to \infty:
- counting primes,
\displaystyle \pi(x;q,a) \sim \frac{1}{\varphi(q)}\,\frac{x}{\log x};
- equivalently, with the Chebyshev weight,
\displaystyle \psi(x;q,a) \sim \frac{x}{\varphi(q)};
- so each admissible class carries an equal share —
\displaystyle \frac{\pi(x;q,a)}{\pi(x)} \to \frac{1}{\varphi(q)},
independent of which class a you picked.
Here \psi(x;q,a) = \sum_{\substack{n \le x \\ n \equiv a \,(q)}} \Lambda(n)
is the summatory von
Mangoldt function restricted to the class, where
\Lambda(n) = \log p if n = p^k and
0 otherwise. The \psi form is the one the analysis
actually proves; the \pi form follows by partial summation. The clean
constant 1/\varphi(q) is the whole story: it does not depend on
a. Nature does not play favourites among the coprime classes.
Worked example: primes mod 4
Take q = 4. The residues coprime to 4 are
1 and 3, so
\varphi(4) = 2. PNT for APs predicts that the primes split
evenly between the two shapes:
\pi(x;4,1) \sim \frac{1}{2}\,\frac{x}{\log x}, \qquad \pi(x;4,3) \sim \frac{1}{2}\,\frac{x}{\log x}.
In words: about half the odd primes are of the form 4k+1
(5, 13, 17, 29, \dots) and about half are of the form
4k+3 (3, 7, 11, 19, \dots). The residue
2 \bmod 4 is not coprime to 4, so it hosts
no odd primes at all — it simply does not enter the count. Two admissible classes, so each collects a
\tfrac12 share; nothing is left over.
A more refined yardstick than x/\log x is the
logarithmic
integral \operatorname{Li}(x) = \int_2^x \frac{dt}{\log t}. The
sharp expectation is that both counts hug \tfrac12 \operatorname{Li}(x). Below,
the two real prime counts (computed by sieving every integer up to x) are
plotted against that common target.
The two prime counts and their shared prediction are almost indistinguishable at this scale — visual
proof of equidistribution. Look very closely, though, and the 3 \bmod 4 curve
tends to sit a hair above the 1 \bmod 4 curve. That persistent tilt
is not noise; it has a name.
Chebyshev noticed in 1853 that primes \equiv 3 \pmod 4 seem to stay
stubbornly ahead of those \equiv 1 \pmod 4 — the count
\pi(x;4,3) - \pi(x;4,1) is positive for the overwhelming majority of
x. This is the famous Chebyshev bias. It does not
contradict equidistribution: the two shares both tend to \tfrac12, and the
lead is only of size about \sqrt{x}/\log x — vanishingly small next to
\pi(x) \approx x/\log x.
The cause is subtle and beautiful: the "prime squares" p^2 are all
\equiv 1 \pmod 4, so the smoother
\psi-count leans very slightly toward class 1,
which forces the raw prime count to lean the other way, toward class 3. The
bias is a real phenomenon of the lower-order terms, invisible in the leading asymptotic.
Astonishingly, Littlewood proved the lead reverses infinitely often — class 1
does take the lead, just very rarely (first around x = 26861).
The engine: characters turn a class into a sum
How do you prove a statement about one residue class using
Dirichlet
L-functions, which are global objects summed over
all integers? The bridge is
character
orthogonality. The Dirichlet characters mod q form a group of
exactly \varphi(q) functions, and they act as a set of filters. Their key
property, for \gcd(a,q)=1, is
\frac{1}{\varphi(q)} \sum_{\chi \bmod q} \overline{\chi}(a)\,\chi(n) = \begin{cases} 1 & n \equiv a \pmod q, \\ 0 & \text{otherwise.} \end{cases}
This indicator lets us detect the class a. Multiply by
\Lambda(n) and sum over n \le x:
\psi(x;q,a) = \frac{1}{\varphi(q)} \sum_{\chi \bmod q} \overline{\chi}(a)\,\psi(x,\chi), \qquad \psi(x,\chi) := \sum_{n \le x} \Lambda(n)\,\chi(n).
We have traded one hard sum over a residue class for \varphi(q) sums
\psi(x,\chi), one per character — and each of those is governed by a
single L-function. That is the entire strategic move.
Each character sum comes from its L-function
The twisted sum \psi(x,\chi) is extracted analytically exactly as in the
ordinary PNT. The logarithmic derivative of L(s,\chi) is a Dirichlet series
whose coefficients are precisely \Lambda(n)\chi(n):
-\frac{L'}{L}(s,\chi) = \sum_{n=1}^{\infty} \frac{\Lambda(n)\,\chi(n)}{n^{s}}.
A Perron
contour integral then recovers the partial sum:
\psi(x,\chi) = \frac{1}{2\pi i} \int_{c-i\infty}^{c+i\infty} \left(-\frac{L'}{L}(s,\chi)\right) \frac{x^{s}}{s}\,ds.
Push the contour left and pick up residues. Everything now hinges on which character you have:
-
The principal character \chi_0. Here
L(s,\chi_0) is essentially the Riemann zeta function (times a few Euler
factors), so it inherits \zeta's simple pole at
s=1. That pole contributes a residue of x,
giving \psi(x,\chi_0) \sim x. This is the main term.
-
Every non-principal character \chi \ne \chi_0. Here
L(s,\chi) has no pole — it is entire. So there is no
x term at all; \psi(x,\chi) = o(x) is pure
error.
Feed this back into the character expansion. Only the \chi_0 term survives to
leading order, and \overline{\chi_0}(a) = 1 for any admissible
a:
\psi(x;q,a) = \frac{1}{\varphi(q)}\Big[\underbrace{x}_{\chi_0\ \text{pole}} + \underbrace{\sum_{\chi \ne \chi_0} \overline{\chi}(a)\,\psi(x,\chi)}_{o(x)\ \text{error}}\Big] \sim \frac{x}{\varphi(q)}.
There it is: the pole of the single principal character supplies the main term
x/\varphi(q), identical for every class; the non-principal characters supply
only error. That is why the share is exactly 1/\varphi(q) and the
same for all admissible a.
Why the error is small: L(1,χ)≠0 and zero-free regions
Two facts make the non-principal terms genuinely negligible, not just hopefully so.
First, L(1,\chi) \ne 0. This is the same non-vanishing that
powered Dirichlet's original theorem. If some L(1,\chi) were zero, the
contour argument would spring a spurious pole and the error term could rival the main term — the class
might even be starved of primes. Non-vanishing at s=1 is what keeps
-L'/L regular on the edge \Re(s)=1.
Second, a zero-free region. Just as PNT needs
\zeta(s) \ne 0 on the line \Re(s)=1 and a little to
its left, PNT for APs needs L(s,\chi) \ne 0 in a similar region. A classical
zero-free region of the shape
\sigma > 1 - \frac{c}{\log\!\big(q(|t|+2)\big)}
for the zeros \rho = \sigma + it pushes the contour left of
\Re(s)=1 and turns the qualitative o(x) into a
quantitative saving, an error like x\,\exp(-c\sqrt{\log x}). Zeros of
L-functions control the error exactly as zeros of
\zeta control the error in ordinary PNT — and the
Generalized Riemann
Hypothesis, that all these zeros lie on \Re(s)=\tfrac12, would
give the best possible error O(\sqrt{x}\,\log^2 x).
Equidistribution is only among the coprime classes. There are exactly
\varphi(q) classes a \bmod q with
\gcd(a,q)=1, and the primes split evenly among those — not among all
q residues. A class with \gcd(a,q) > 1 contains at
most one prime, so it gets a share of 0, not
1/q. Mod 10 the primes fill classes
1,3,7,9 at \tfrac14 each — not
\tfrac{1}{10} each.
And the error term secretly depends on Siegel zeros. The clean statement holds for
fixed q as x \to \infty. The deep issue is
uniformity in q: can you let q grow
with x and keep control? A real character can, in principle, host an
exceptional real zero — a Siegel zero — maddeningly close to
s=1, which would inflate that character's error. Nobody has ruled Siegel
zeros out. The best unconditional uniform result,
Siegel–Walfisz,
works only for q \le (\log x)^A and carries an ineffective constant
precisely because of the possible Siegel zero. Getting uniformity for much larger
q needs the Bombieri–Vinogradov theorem (on average) or GRH (conditionally).
What "equidistributed" really means
Equidistribution is a statement about proportions in the limit, and it is worth being precise
about what it does and does not claim.
-
It claims: the fraction of primes up to x falling in each
admissible class tends to 1/\varphi(q). Long-run, the classes are
indistinguishable by density.
-
It does not claim: the classes are equal at any finite
x, nor that they take turns, nor that the small differences between them
are random. The Chebyshev bias is a real, structured, persistent inequality living entirely inside the
error term — the leading term is blind to it.
So "the primes don't care about last digits" is true asymptotically and false in the fine print. The
leading term is perfectly even; the character sums \psi(x,\chi) for
\chi\ne\chi_0 encode every deviation from that perfect evenness, and their
size is dictated by where the zeros of L(s,\chi) sit.
It genuinely does not — and that is the surprising part. The main term
x/\varphi(q) comes entirely from the principal character, whose contribution
is weighted by \overline{\chi_0}(a) = 1 for every admissible
a. All the a-dependence lives in the non-principal
terms \overline{\chi}(a)\psi(x,\chi), which are error. So two classes as
different-looking as 1 \bmod 100 and 37 \bmod 100
receive precisely the same leading count, x/\varphi(100) = x/40 of the
\psi-weight. The class label only ever nudges the lower-order terms.