Dirichlet hyperbola method

In number theory, the Dirichlet hyperbola method is a technique to evaluate the sum
where Template:Mvar is a multiplicative function. The first step is to find a pair of multiplicative functions Template:Mvar and Template:Mvar such that, using Dirichlet convolution, we have Template:Math; the sum then becomes
where the inner sum runs over all ordered pairs Template:Math of positive integers such that Template:Math. In the Cartesian plane, these pairs lie on a hyperbola, and when the double sum is fully expanded, there is a bijection between the terms of the sum and the lattice points in the first quadrant on the hyperbolas of the form Template:Math, where Template:Mvar runs over the integers Template:Math: for each such point Template:Math, the sum contains a term Template:Math, and vice versa.
Let Template:Mvar be a real number, not necessarily an integer, such that Template:Math, and let Template:Math. Then the lattice points can be split into three overlapping regions: one region is bounded by Template:Math and Template:Math, another region is bounded by Template:Math and Template:Math, and the third is bounded by Template:Math and Template:Math. In the diagram, the first region is the union of the blue and red regions, the second region is the union of the red and green, and the third region is the red. Note that this third region is the intersection of the first two regions. By the principle of inclusion and exclusion, the full sum is therefore the sum over the first region, plus the sum over the second region, minus the sum over the third region. This yields the formula
Examples
Let Template:Math be the divisor-counting function, and let Template:Math be its summatory function:
Computing Template:Math naïvely requires factoring every integer in the interval Template:Math; an improvement can be made by using a modified Sieve of Eratosthenes, but this still requires Template:Math time. Since Template:Math admits the Dirichlet convolution Template:Math, taking Template:Math in (Template:EquationNote) yields the formula
which simplifies to
which can be evaluated in Template:Math operations.
The method also has theoretical applications: for example, Peter Gustav Lejeune Dirichlet introduced the technique in 1849 to obtain the estimate[1][2]
where Template:Mvar is the Euler–Mascheroni constant.