The Selberg upper-bound sieve replaces the indicator function of a sifted set by the square of a divisor sum. If the real Selberg sieve weights satisfy , then
When has no forbidden prime factors, the divisor sum is exactly one; otherwise its square is still nonnegative. Taking the weights to vanish for controls the error in summing this majorant. The main term is a positive quadratic form that can be diagonalized and minimized explicitly. This optimization, together with a bound for the remainder, is the central idea of the Selberg sieve.
For twin primes, take and let be the number of its roots modulo a squarefree integer . The Chinese remainder theorem makes a multiplicative arithmetic function, with and for odd primes. Thus the polynomial root density in a sieve is , and
Summing the majorant gives
where , with all indices squarefree. Here controls the error.
We carry out the Selberg sieve diagonalization. Put
For squarefree integers , multiplicativity gives
The identity behind the first equality is . Möbius inversion gives . The Cauchy-Schwarz inequality therefore implies
Define . Equality is attained at , giving . Inverting again, the optimizing Selberg sieve weights are
In particular . Since ,
The last inequality holds separately at , , and . Together with , this crude bound already makes the remainder , because .
We also need a lower bound for ; we prove it rather than presuppose a sieve asymptotic. For odd squarefree integers ,
where counts distinct prime factors. Put and . The total weight of odd pairs is . Exclude pairs for which has a square prime factor, has a square prime factor, or have a common prime factor. For each of these three categories the total weight is at most : for example, the weighted count of odd multiples of is , and the common-factor category uses for each variable. Moreover,
Hence the remaining odd coprime squarefree pairs have weight at least . Their products are squarefree, and counts all ordered coprime factorizations of . This proves the elementary lower bound for the twin-prime sieve denominator:
If and both are primes, survives the sieve. The at most smaller values are the only exceptions. Thus, with and , the twin-prime upper bound from a quadratic sieve becomes
Finally partial summation gives
The integral over is bounded by a constant times . The nonnegative partial sums are therefore bounded and increasing. Thus the reciprocal series over the smaller members of twin-prime pairs converges, a form of Brun's theorem. The upper bound does not assert that infinitely many twin primes exist.
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.
Let
and let be the product of the finitely many primes at most or dividing some nonzero difference . Sieve with the primes . For such a prime, the congruence has exactly distinct roots. By the Chinese remainder theorem, the root-counting function is multiplicative on squarefree coprime to , and
Thus the polynomial root density in a sieve applies with
Take and . For squarefree coprime to ,
The supplied mean-value estimate, partial summation, and removal of square factors using give
The error in the Selberg upper-bound sieve is
Consequently
If every is prime and all of them exceed , then has no prime divisor with , apart from a fixed finite set of divisibility cases absorbed into the implied constant. The cases with some contribute . Therefore
Put and let be the number of roots of modulo . For squarefree , the Chinese remainder theorem gives
Indeed, for the three roots are distinct. Counting in each of the residue classes gives
Consequently a suitable sieve distribution is
This is the polynomial root density in a sieve calculation.