Perron's Formula

Every arithmetic sequence a_1, a_2, a_3, \dots — the number of divisors, the von Mangoldt weights, the constant sequence of ones — can be packed into a single Dirichlet series

F(s) = \sum_{n=1}^{\infty} \frac{a_n}{n^{s}},

a function of a complex variable s = \sigma + it. The series encodes the whole sequence, but in a maddeningly global way: nothing in F(s) obviously reads off "add up the first x terms." Yet the partial sum \sum_{n\le x} a_n is exactly what we care about — it is \pi(x) for the primes, \psi(x) for the prime powers, the summatory divisor function, and so on.

Perron's formula is the machine that inverts the packing. It reaches into a Dirichlet series with a single vertical contour integral and pulls back out the running total of the coefficients. It is the pivot on which the whole analytic proof of the Prime Number Theorem turns: feed it -\zeta'/\zeta and it hands you \psi(x); slide the contour past the pole of \zeta at s = 1 and the residue there is the main term \psi(x) \sim x.

The heart of it: a discontinuous integral

Everything rests on one strange little integral. Fix a positive real number y and a vertical line \Re(s) = c > 0, and consider

I(y) = \frac{1}{2\pi i}\int_{c-i\infty}^{c+i\infty} \frac{y^{s}}{s}\,ds.

The astonishing fact is that this smooth-looking contour integral is discontinuous in y: it does not glide from one value to another, it jumps.

For c > 0,

\frac{1}{2\pi i}\int_{c-i\infty}^{c+i\infty} \frac{y^{s}}{s}\,ds \;=\; \begin{cases} 1, & y > 1,\\[4pt] \tfrac12, & y = 1,\\[4pt] 0, & 0 < y < 1. \end{cases}

The proof is a textbook contour argument. Write y^{s} = e^{s\ln y}. If y > 1 then \ln y > 0, so y^{s} decays as \Re(s)\to -\infty: close the contour with a huge semicircle to the left, and it encloses the single simple pole of y^{s}/s at s = 0. The residue there is y^{0} = 1, so the residue theorem gives I(y) = 1. If 0 < y < 1 then \ln y < 0 and y^{s} decays to the right, where the enclosed region is empty of poles — so I(y) = 0. Exactly on the boundary y = 1 the contour skims half the pole, and the symmetric principal value gives \tfrac12.

From the kernel to the formula

Now watch the trick. We want \sum_{n\le x} a_n. Set y = x/n in the kernel: it equals 1 exactly when n < x, and 0 when n > x. In other words, I(x/n) is a switch that is on for the terms we want to keep and off for the rest. Multiply each coefficient by its switch and sum:

\sum_{n=1}^{\infty} a_n \cdot \frac{1}{2\pi i}\int_{c-i\infty}^{c+i\infty} \frac{(x/n)^{s}}{s}\,ds \;=\; \sideset{}{'}\sum_{n\le x} a_n.

Pull the sum inside the integral (this is where the convergence needs care — see the warning below) and use (x/n)^{s} = x^{s}\,n^{-s}. The sum \sum_n a_n n^{-s} reassembles into F(s), and out drops the formula.

\sideset{}{'}\sum_{n\le x} a_n \;=\; \frac{1}{2\pi i}\int_{c-i\infty}^{c+i\infty} F(s)\,\frac{x^{s}}{s}\,ds.

Read it as a Mellin inversion: F(s)/s is essentially the Mellin transform of the step function x \mapsto \sum_{n\le x} a_n, and the vertical integral is the inverse transform recovering it. The line \Re(s) = c must sit strictly to the right of \sigma_a — the abscissa of absolute convergence — so that everything in sight converges.

Poles → main terms, the rest → error

The vertical integral by itself is inert — a faithful but opaque copy of the partial sum. The method is to move the contour. Push the line \Re(s) = c leftward to some \Re(s) = b. As it sweeps across the plane it drags across the poles of the integrand F(s)\,x^{s}/s, and the residue theorem says the integral changes by exactly the sum of the residues picked up:

\frac{1}{2\pi i}\int_{(c)} F(s)\frac{x^{s}}{s}\,ds \;=\; \sum_{\text{poles between } b \text{ and } c} \operatorname*{Res}\; F(s)\frac{x^{s}}{s} \;+\; \frac{1}{2\pi i}\int_{(b)} F(s)\frac{x^{s}}{s}\,ds.

This single equation is the entire strategy of analytic number theory in miniature:

For -\zeta'(s)/\zeta(s) = \sum \Lambda(n) n^{-s}, the pole of \zeta at s = 1 makes -\zeta'/\zeta have a simple pole there with residue 1; the extra x^{s}/s contributes x^{1}/1 = x. That single residue is the celebrated main term \psi(x) \sim x — the explicit formula and the Prime Number Theorem fall straight out of it.

Picturing the contour shift

Below, the horizontal axis is \Re(s) and the vertical axis is \Im(s). Step through: first the original vertical contour \Re(s) = c sitting safely to the right of everything; then the pole of the integrand at s = 1; then the contour slid left to \Re(s) = b < 1, having swept across the pole and collected its residue.

The area swept between the two vertical lines is where the residue lives. Everything to its left — the integral along \Re(s) = b — is demoted to the error term. That picture, "one main pole and a controllable leftover," is the shape of essentially every proof in this course.

Worked example: counting with F = \zeta

Take the plainest sequence of all, a_n = 1 for every n. Then F(s) = \sum_{n\ge1} n^{-s} = \zeta(s), which converges absolutely for \Re(s) > 1, so \sigma_a = 1. The partial sum we are recovering is simply the count \sum_{n\le x} 1 = \lfloor x\rfloor. Perron's formula, with any c > 1, says

\sideset{}{'}\sum_{n\le x} 1 \;=\; \frac{1}{2\pi i}\int_{c-i\infty}^{c+i\infty} \zeta(s)\,\frac{x^{s}}{s}\,ds.

Now apply the strategy. The integrand \zeta(s)\,x^{s}/s has two poles to the right of a line we can shift to:

Shift the contour to a line b with 0 < b < 1 (past the s=1 pole) and collect:

\sideset{}{'}\sum_{n\le x} 1 \;=\; \underbrace{x}_{\text{main term}} \;-\; \underbrace{\tfrac12}_{\zeta(0)} \;+\; \big(\text{shifted integral}\big).

The leading term is x — precisely the estimate \sum_{n\le x} 1 \approx x we already knew from \lfloor x\rfloor = x + O(1). The -\tfrac12 is the exact average correction (\lfloor x\rfloor \approx x - \tfrac12 "on average"), and the shifted integral supplies the sawtooth fluctuation. A sledgehammer for a nut here — but the same sledgehammer, aimed at -\zeta'/\zeta instead of \zeta, cracks the Prime Number Theorem.

The truncated formula — what you actually use

There is a catch that makes the pretty formula unusable as written: the infinite vertical integral is only conditionally convergent (the integrand decays like 1/|t| along the line, not absolutely). To do real analysis you cut the contour off at height \pm iT and carry the error you introduce. This is the truncated Perron formula, the version that appears in every proof.

\sideset{}{'}\sum_{n\le x} a_n \;=\; \frac{1}{2\pi i}\int_{c-iT}^{c+iT} F(s)\,\frac{x^{s}}{s}\,ds \;+\; R, R \;=\; O\!\left(\frac{x^{c}}{T}\sum_{n=1}^{\infty}\frac{|a_n|}{n^{c}\,\bigl(1+|\ln(x/n)|\bigr)}\right) \;+\; O\!\left(\frac{x}{T}\right),

The shape to remember is R = O(x^{c}/T) up to logarithms: the error dies as you raise the cutoff T, and it grows with x^{c}. In practice you choose c = 1 + 1/\ln x (so x^{c} stays comparable to x) and pick T as a power of x to balance this truncation error against the shifted-contour error. The whole art of a PNT proof is booking these two errors against each other.

Two subtleties bite newcomers, and both are baked into the statement.

The integral is only conditionally convergent. Along the line \Re(s)=c the integrand behaves like C/|t| as |t|\to\infty, so \int |{\cdot}|\,dt diverges — the integral exists only as a symmetric limit \lim_{T\to\infty}\int_{c-iT}^{c+iT}. You may not freely swap the infinite sum and the integral without justification; the honest route is always to truncate first, estimate, and only then let T\to\infty. This is why the truncated version, not the clean one, is what real proofs invoke.

The prime on the sum is not decoration. The mark \sideset{}{'}\sum means: when x is exactly an integer, count the final term a_x with weight \tfrac12, not 1. It comes straight from the y = 1 case of the kernel, where the integral is \tfrac12. Forget it and your formula is off by \tfrac12 a_x at every jump — small, but fatal in an exact identity like the explicit formula. (This is also why authors often assume x \notin \mathbb{Z} to sidestep it entirely.)

The factor 1/s is doing two jobs at once. First, it is what makes the kernel a step: \int y^{s}\,ds without the 1/s wouldn't converge or invert to an indicator function; the 1/s supplies the single simple pole at s=0 whose residue y^{0}=1 is the "on" value. Second, it is the Mellin transform of the constant function on [0,1], so dividing F(s) by s corresponds to integrating the coefficients — turning the pointwise density a_n into the running total \sum_{n\le x} a_n. Dividing by s^{2} instead (Perron's second formula) recovers the smoother \sum_{n\le x}(x-n)a_n — a trick used when the sharp cutoff is too rough to control, at the cost of having to un-smooth the answer afterwards.

The one-line summary

Perron's formula turns the question "what is \sum_{n\le x} a_n?" into the question "where are the poles of F(s)\,x^{s}/s, and how big is what's left?" That is a spectacular trade: partial sums are combinatorial and hard, but poles and residues are complex-analytic and often computable in one line. Master this bridge and the entire analytic theory of the primes opens up on the far side.