# Sieve theory

Sieve theory is a set of general techniques in number theory, designed to count, or more realistically to estimate the size of, sifted sets of integers. The prototypical example of a sifted set is the set of prime numbers up to some prescribed limit X. Correspondingly, the prototypical example of a sieve is the sieve of Eratosthenes, or the more general Legendre sieve. The direct attack on prime numbers using these methods soon reaches apparently insuperable obstacles, in the way of the accumulation of error terms. In one of the major strands of number theory in the twentieth century, ways were found of avoiding some of the difficulties of a frontal attack with a naive idea of what sieving should be.
One successful approach is to approximate a specific sifted set of numbers (e.g. the set of prime numbers) by another, simpler set (e.g. the set of almost prime numbers), which is typically somewhat larger than the original set, and easier to analyze. More sophisticated sieves also do not work directly with sets per se, but instead count them according to carefully chosen weight functions on these sets (options for giving some elements of these sets more "weight" than others). Furthermore, in some modern applications, sieves are used not to estimate the size of a sifted set, but to produce a function that is large on the set and mostly small outside it, while being easier to analyze than the characteristic function of the set.
The term sieve was first used by the Norwegian mathematician Viggo Brun in 1915. However Brun's work was inspired by the works of the French mathematician Jean Merlin who died in the World War I and only two of his manuscripts survived.

## Basic sieve theory

For information on notation see at the end. We follow the Ansatz from Opera de Cribro by John Friedlander and Henryk Iwaniec.
We start with some countable sequence of non-negative numbers ${\mathcal {A}}=(a_{n})$. In the most basic case this sequence is just the indicator function $a_{n}=1_{A}(n)$ of some set $A=\{s:s\leq x\}$ we want to sieve. However this abstraction allows for more general situations. Next we introduce a general set of prime numbers called the sifting range ${\mathcal {P}}\subseteq \mathbb {P}$ and their product up to $z$ as a function $P(z)=\prod \limits _{p\in {\mathcal {P}},p<z}p$.
The goal of sieve theory is to estimate the sifting function
    $S({\mathcal {A}},{\mathcal {P}},z)=\sum \limits _{n\leq x,{\text{gcd}}(n,P(z))=1}a_{n}.$
In the case of $a_{n}=1_{A}(n)$ this just counts the cardinality of a subset $A_{\operatorname {sift} }\subseteq A$ of numbers, that are coprime to the prime factors of $P(z)$.

### The inclusion–exclusion principle

For ${\mathcal {P}}$ define
    $A_{\operatorname {sift} }:=\{a\in A|(a,p_{1}\cdots p_{k})=1\},\quad p_{1},\dots ,p_{k}\in {\mathcal {P}}$
and for each prime $p\in {\mathcal {P}}$ denote the subset $E_{p}\subseteq A$ of multiples $E_{p}:=\{pn:n\in \mathbb {N} \}$ and let $|E_{p}|$ be the cardinality.
We now introduce a way to calculate the cardinality of $A_{\operatorname {sift} }$. For this the sifting range ${\mathcal {P}}$ will be a concrete example of primes of the form ${\mathcal {P}}:=\{2,3,5,7,11,13\dots \}$.
If one wants to calculate the cardinality of $A_{\operatorname {sift} }$, one can apply the inclusion–exclusion principle. This algorithm works like this: first one removes from the cardinality of $|A|$ the cardinality $|E_{2}|$ and $|E_{3}|$. Now since one has removed the numbers that are divisible by $2$ and $3$ twice, one has to add the cardinality $|E_{6}|$. In the next step one removes $|E_{5}|$ and adds $|E_{10}|$ and $|E_{15}|$ again. Additionally one has now to remove $|E_{30}|$, i.e. the cardinality of all numbers divisible by $2,3$ and $5$. This leads to the inclusion–exclusion principle
    $|A_{\operatorname {sift} }|=|A|-|E_{2}|-|E_{3}|+|E_{6}|-|E_{5}|+|E_{10}|+|E_{15}|-|E_{30}|+\cdots$
Notice that one can write this as
    $|A_{\operatorname {sift} }|=\sum \limits _{d|P}\mu (d)|E_{d}|$
where $\mu$ is the Möbius function and $P:=\prod \limits _{p\in {\mathcal {P}}}p$ the product of all primes in ${\mathcal {P}}$ and $E_{1}:=A$.

### Legendre's identity

We can rewrite the sifting function with Legendre's identity
    $S({\mathcal {A}},{\mathcal {P}},z)=\sum \limits _{d\mid P(z)}\mu (d)A_{d}(x)$
by using the Möbius function and some functions $A_{d}(x)$ induced by the elements of ${\mathcal {P}}$
    $A_{d}(x)=\sum \limits _{n\leq x,n\equiv 0{\pmod {d}}}a_{n}.$

#### Example

Let $z=7$ and ${\mathcal {P}}=\mathbb {P}$. The Möbius function is negative for every prime, so we get
    ${\begin{aligned}S({\mathcal {A}},\mathbb {P} ,7)&=A_{1}(x)-A_{2}(x)-A_{3}(x)-A_{5}(x)+A_{6}(x)+A_{10}(x)+A_{15}(x)-A_{30}(x).\end{aligned}}$

### Approximation of the congruence sum

One assumes then that $A_{d}(x)$ can be written as
    $A_{d}(x)=g(d)X+r_{d}(x)$
where $g(d)$ is a density, meaning a multiplicative function such that
    $g(1)=1,\qquad 0\leq g(p)<1\qquad p\in \mathbb {P}$
and $X$ is an approximation of $A_{1}(x)$ and $r_{d}(x)$ is some remainder term. The sifting function becomes
    $S({\mathcal {A}},{\mathcal {P}},z)=X\sum \limits _{d\mid P(z)}\mu (d)g(d)+\sum \limits _{d\mid P(z)}\mu (d)r_{d}(x)$
or in short
    $S({\mathcal {A}},{\mathcal {P}},z)=XG(x,z)+R(x,z).$
One tries then to estimate the sifting function by finding upper and lower bounds for $S$ respectively $G$ and $R$.
The partial sum of the sifting function alternately over- and undercounts, so the remainder term will be huge. Brun's idea to improve this was to replace $\mu (d)$ in the sifting function with a weight sequence $(\lambda _{d})$ consisting of restricted Möbius functions. Choosing two appropriate sequences $(\lambda _{d}^{-})$ and $(\lambda _{d}^{+})$ and denoting the sifting functions with $S^{-}$ and $S^{+}$, one can get lower and upper bounds for the original sifting functions
    $S^{-}\leq S\leq S^{+}.$
Since $g$ is multiplicative, one can also work with the identity
    $\sum \limits _{d\mid n}\mu (d)g(d)=\prod \limits _{\begin{array}{c}p|n;\;p\in \mathbb {P} \end{array}}(1-g(p)),\quad \forall \;n\in \mathbb {N} .$
Notation: a word of caution regarding the notation, in the literature one often identifies the set of sequences ${\mathcal {A}}$ with the set $A$ itself. This means one writes ${\mathcal {A}}=\{s:s\leq x\}$ to define a sequence ${\mathcal {A}}=(a_{n})$. Also in the literature the sum $A_{d}(x)$ is sometimes notated as the cardinality $|A_{d}(x)|$ of some set $A_{d}(x)$, while we have defined $A_{d}(x)$ to be already the cardinality of this set. We used $\mathbb {P}$ to denote the set of primes and $(a,b)$ for the greatest common divisor of $a$ and $b$.

## Types of sieving

Modern sieves include the Brun sieve, the Selberg sieve, the Turán sieve, the large sieve, the larger sieve and the Goldston–Pintz–Yıldırım sieve. One of the original purposes of sieve theory was to try to prove conjectures in number theory such as the twin prime conjecture. While the original broad aims of sieve theory still are largely unachieved, there have been some partial successes, especially in combination with other number theoretic tools. Highlights include:
* Brun's theorem, which shows that the sum of the reciprocals of the twin primes converges (whereas the sum of the reciprocals of all primes diverges);
* Chen's theorem, which shows that there are infinitely many primes p such that p + 2 is either a prime or a semiprime (the product of two primes); a closely related theorem of Chen Jingrun asserts that every sufficiently large even number is the sum of a prime and another number which is either a prime or a semiprime. These can be considered to be near-misses to the twin prime conjecture and the Goldbach conjecture respectively.
* The fundamental lemma of sieve theory, which asserts that if one is sifting a set of N numbers, then one can accurately estimate the number of elements left in the sieve after $N^{\varepsilon }$ iterations provided that $\varepsilon$ is sufficiently small (fractions such as 1/10 are quite typical here). This lemma is usually too weak to sieve out primes (which generally require something like $N^{1/2}$ iterations), but can be enough to obtain results regarding almost primes.
* The Friedlander–Iwaniec theorem, which asserts that there are infinitely many primes of the form $a^{2}+b^{4}$.
* Zhang's theorem (Zhang 2014), which shows that there are infinitely many pairs of primes within a bounded distance. The Maynard–Tao theorem (Maynard 2015) generalizes Zhang's theorem to arbitrarily long sequences of primes.

## Techniques of sieve theory

The techniques of sieve theory can be quite powerful, but they seem to be limited by an obstacle known as the parity problem, which roughly speaking asserts that sieve theory methods have extreme difficulty distinguishing between numbers with an odd number of prime factors and numbers with an even number of prime factors. This parity problem is still not very well understood.
Compared with other methods in number theory, sieve theory is comparatively elementary, in the sense that it does not necessarily require sophisticated concepts from either algebraic number theory or analytic number theory. Nevertheless, the more advanced sieves can still get very intricate and delicate (especially when combined with other deep techniques in number theory), and entire textbooks have been devoted to this single subfield of number theory; a classic reference is (Halberstam & Richert 1974) and a more modern text is (Iwaniec & Friedlander 2010).
The sieve methods discussed in this article are not closely related to the integer factorization sieve methods such as the quadratic sieve and the general number field sieve. Those factorization methods use the idea of the sieve of Eratosthenes to determine efficiently which members of a list of numbers can be completely factored into small primes.

## Literature

* Cojocaru, Alina Carmen; Murty, M. Ram (2006), An introduction to sieve methods and their applications, London Mathematical Society Student Texts, vol. 66, Cambridge University Press, ISBN 0-521-84816-4, MR 2200366
* Motohashi, Yoichi (1983), Lectures on Sieve Methods and Prime Number Theory, Tata Institute of Fundamental Research Lectures on Mathematics and Physics, vol. 72, Berlin: Springer-Verlag, ISBN 3-540-12281-8, MR 0735437
* Greaves, George (2001), Sieves in number theory, Ergebnisse der Mathematik und ihrer Grenzgebiete (3), vol. 43, Berlin: Springer-Verlag, doi:10.1007/978-3-662-04658-6, ISBN 3-540-41647-1, MR 1836967
* Harman, Glyn (2007). Prime-detecting sieves. London Mathematical Society Monographs. Vol. 33. Princeton, NJ: Princeton University Press. ISBN 978-0-691-12437-7. MR 2331072. Zbl 1220.11118.
* Halberstam, Heini; Richert, Hans-Egon (1974). Sieve Methods. London Mathematical Society Monographs. Vol. 4. London-New York: Academic Press. ISBN 0-12-318250-6. MR 0424730.
* Iwaniec, Henryk; Friedlander, John (2010), Opera de cribro, American Mathematical Society Colloquium Publications, vol. 57, Providence, RI: American Mathematical Society, ISBN 978-0-8218-4970-5, MR 2647984
* Hooley, Christopher (1976), Applications of sieve methods to the theory of numbers, Cambridge Tracts in Mathematics, vol. 70, Cambridge-New York-Melbourne: Cambridge University Press, ISBN 0-521-20915-3, MR 0404173
* Maynard, James (2015). "Small gaps between primes". Annals of Mathematics. 181 (1): 383–413. arXiv:1311.4600. doi:10.4007/annals.2015.181.1.7. MR 3272929.
* Tenenbaum, Gérald (1995), Introduction to Analytic and Probabilistic Number Theory, Cambridge studies in advanced mathematics, vol. 46, Translated from the second French edition (1995) by C. B. Thomas, Cambridge University Press, pp. 56–79, ISBN 0-521-41261-7, MR 1342300
* Zhang, Yitang (2014). "Bounded gaps between primes". Annals of Mathematics. 179 (3): 1121–1174. doi:10.4007/annals.2014.179.3.7. MR 3171761.