The Selberg upper-bound sieve replaces an exact but long inclusion-exclusion expansion by a short nonnegative square, and then minimizes its main term. For an interval , the count of multiples of every integer is
Crucially the remainder bound is independent of .
Let and take real weights , supported on squarefree , with . If , the sum of these weights over divisors of is just one; for all other its square is nonnegative. Thus
Expanding and counting common multiples gives
This separates the local density from a uniform interval error. The weights will be chosen to minimize .
The Euler totient function identity yields the Selberg sieve diagonalization
Only squarefree occur. Inverting this finite triangular sum by Möbius inversion gives
Write . The Cauchy-Schwarz inequality gives , with equality at . The inverse formula then produces the optimal Selberg sieve weights
The constraints are satisfied, since the diagonal transformation is invertible and .
We need the leading constant, not just . Here is an elementary proof of the Selberg sieve denominator asymptotic. For define the multiplicative arithmetic function by
Checking the prime-local factors shows . Also : the local factors for absolute values differ from one by , and their logarithmic first moments sum . The signed local sums are all one, so absolute convergence gives . Using the harmonic number estimate,
For the last equality, is bounded and is bounded too.
The optimal Selberg weights have modulus at most one. To prove this here, for squarefree use . The product is the sum of over , , , with squarefree. All are distinct squarefree integers at most , and so these are a subset of the terms of . The displayed weight formula now gives . Consequently
Every prime in the interval exceeding survives the sieve; at most smaller primes must be restored. Choose . Then
and the uniform interval bound from optimal Selberg weights follows:
All constants are independent of . Given , make the absolute error in the coefficient smaller than by choosing large enough. Uniformly for every and ,
Let count primes for which is also prime. We prove using a quadratic Selberg sieve, then apply Abel summation.
For , each odd prime has exactly two roots modulo that prime. The Chinese remainder theorem gives the polynomial root density in a sieve
for odd squarefree integers . Put and choose the optimizing real Selberg sieve weights , supported on these , with . If are prime and , their weight is one. It is nonnegative for every other integer. Expanding the square therefore gives
The Selberg sieve diagonalization makes the main quadratic form , where
The optimal Selberg weights have modulus at most one. Since , the remainder is at most .
For completeness, the lower bound on is where the second logarithm enters. Restrict to primes and put . The full product is , since its logarithm is and the Mertens second theorem applies. Give the associated squarefree divisor probability . Prime inclusion probabilities are , so the Mertens first theorem gives
for large . The Markov inequality shows that at least half the weight has . This proves the truncated Euler-product lower bound . Consequently the twin-prime upper bound from a quadratic sieve is
Finally, Abel summation gives
The tail is dominated by . Thus reciprocal-sum convergence from a counting bound proves convergence of the first reciprocal sum. The second is smaller termwise. We have proved Brun's theorem:
Counting each twin prime just once changes at most a finite repetition and gives the same conclusion.
Set , and restrict attention to the set of squarefree integers all of whose prime factors lie in . Coefficients indexed by non-squarefree integers do not affect , so they may be set to zero. Put
In particular, the normalizing sum runs to , as in the PDF; the converted TeX's is a transcription error. Define . The finite multiples version of Möbius inversion is
It follows by substituting the definition and using . Taking gives . Thus the Selberg sieve diagonalization and the Cauchy-Schwarz inequality give
Equality holds at , which satisfies the constraint. Inverting, and writing , yields
For set . The formula has and gives minimum .
To show these optimal Selberg weights have modulus at most one, fix . Each integer , with , and , is a distinct term of . The total weight of these terms is
It is at most , so the displayed formula gives . This proves the modulus bound without assuming that each factor is itself small.
For , every odd prime has two forbidden residue classes. Use Selberg sieve weights supported on odd squarefree integers . Their main quadratic form is , where . The truncated Euler-product lower bound applied to primes up to gives : the mean logarithmic divisor size is , by the Mertens first theorem, and the full product is , by the Mertens second theorem. The optimal Selberg weights have modulus at most one, so the remainder is at most . The finitely many possible pairs with contribute . Thus the count is , proving the bound.
For all interval origins , the number of multiples of any in is with an absolute error bound. The Selberg sieve diagonalization minimizes , subject to , at . The optimal Selberg weights have modulus at most one, so the total remainder is . Restoring the at most small primes gives . Take and use the Selberg sieve denominator asymptotic. The resulting is independent of .