MathLabs
TheoremProved

Correctness of the Sieve of Eratosthenes

Statement

An integer n≥2n \ge 2 is prime if and only if it is not divisible by any prime p≤np \le \sqrt n.

Why is it true?

This equivalence is exactly what lets the sieve stop early: once every prime up to N\sqrt N has crossed off its multiples, there is no possible witness left to convict any remaining number of being composite, so testing (or crossing off) larger primes is provably wasted work.

Proof sketch

(⇐\Leftarrow) Suppose nn has no prime factor ≤n\le\sqrt n. If nn were composite, write n=abn=ab with 1<a≤b<n1<a\le b<n. Then a≤na\le\sqrt n (otherwise a>na>\sqrt n and b≥a>nb\ge a>\sqrt n would force ab>nab>n, a contradiction), and aa's smallest prime factor pp satisfies p≤a≤np\le a\le\sqrt n, so pp is a prime factor of nn that is ≤n\le\sqrt n — contradicting the hypothesis. So nn has no such factorization, hence nn is prime.

(⇒\Rightarrow) If nn is prime, its only positive divisors are 11 and nn; no prime p<np<n divides it at all, so in particular none with p≤np\le\sqrt n does either.

Together these show the two conditions are equivalent, which is exactly the termination criterion used in the sieve: after processing every prime up to N\sqrt N, everything still unmarked in [2,N][2,N] satisfies the right-hand side, hence is prime.

Topics that use this theorem

Step-by-step proofs

No step-by-step proof yet for this theorem.

References

  1. Alina Carmen Cojocaru, M. Ram Murty (2005). An Introduction to Sieve Methods and Their Applications
  2. Yitang Zhang (2014). Bounded gaps between primes · DOI:10.4007/annals.2014.179.3.7
  3. James Maynard (2015). Small gaps between primes · DOI:10.4007/annals.2015.181.1.7