6

It is known that the Sieve of Erastothenes can be analytically stated as:

Let $P$ be the product of the prime numbers $\leq \sqrt{N}$ and $\omega(n)$ the number of different prime divisors of $n\in\mathbb N$. Then $$ \pi(N)=\pi(\sqrt{N})-1+\sum_{d \mid P}(-1)^{\omega(d)}\left\lfloor\frac{N}{d}\right\rfloor. $$ The sum is to be calculated over all divisors $d$ of $P$.

Where can I find a proof of this statement? When I search for information about this sieve online, I only find algorithms for counting primes and approximations or bounds for $\pi(x)$.

Thank you.

user3141592
  • 1,995
  • Also, one has $$\pi(x)=-\sum\limits_{n=1}^{\log_2(x)} \mu(n) \sum\limits_{k=1}^{x^{1/n}} \mu(k), \nu(k) \left\lfloor\frac{x^{1/n}}{k}\right\rfloor$$ where $\nu(k)$ is the number of distinct primes dividing $k$, – Steven Clark Jun 01 '24 at 19:03

2 Answers2

4

Consider a number $x$ and a list of primes $p_i$ less than $\sqrt{x},$ $p_1,p_2,...,p_m.$ Sieve out multiples of primes in the list less than $x,$ to wit: $2, 4, 6,...,$ etc., $3,6,9,...,$ etc., so that we have taken out $[x/2], [x/3],...,[x/p_i]$, etc., numbers.

Some of those we removed are are duplicates since, for example, $6$ would be removed both as a multiple of $2$ and of $3$. So remove from this initial sieving multiples of two primes, $2\cdot3, 3\cdot 5,$ etc., so we are excluding from the sieve $[x/6],[x/15],...,[x/(p_ip_j)]$ numbers.

But again we are removing some numbers twice, such as 30, which has as divisors both $2\cdot3 $ and $3\cdot 5.$ We throw those back into the sieve.

We continue until we reach the prime $p_m.$ Having sieved for all primes less than $\sqrt{x}$ we are left with primes between $\sqrt{x}$ and $x$, as well as $1,$ which was not sieved.

So we have

$$\pi(x)-\pi(\sqrt{x})+ 1 = x-[x/2]-[x/3]...+[x/(2\cdot3]+[x/(3\cdot 5)]...- [x/(2\cdot3\cdot 5)])... $$

A more compact notation for this expression is

$$\pi(x)-\pi(\sqrt{x})=~-1 + \sum_{d|D}\mu(d)\left[\frac{x}{d}\right] $$

in which $\mu(x)$ is the Mobius function and $D$ is the product of primes less than or equal to $\sqrt{x}$. A proof that the Mobius function assigns the correct sign to each expression $[x/d]$ can be found in many references $^1$. The point is that the right hand side is the number of numbers in $(1,x)$ which are coprime to primes less than or equal to $p_m,$ the largest prime not exceeding $\sqrt{x}.$ We subtract 1 because it is left over and not considered a prime.

The expression on the right can also be expressed in terms of sets. Anything that captures the inclusion-exclusion process described above is acceptable.

$^1 [x]$ is the floor function, often denoted $\lfloor x \rfloor$ in modern texts.

$^2$ See, for example, Narkiewicz, The Development of Prime Number Theory at p.33.

daniel
  • 10,501
1

Let $p_1, p_2, \ldots, p_r$ be the prime numbers $\leq \sqrt{N}$. Furthermore, let $$ \begin{aligned} A_i &=\left\{n \in \mathbb{N} \mid 2 \leq n \leq N \text { and } p_i \mid n\right\} \quad(i=1,2, \ldots, r), \\ A &=\left\{n \in \mathbb{N} \mid 2 \leq n \leq N \text { and }\left(p_1 \mid n \text { or } p_2 \mid n \text { or } \ldots \text { or } p_r \mid n\right)\right\}, \end{aligned} $$ so $$ A=\bigcup_{i=1}^r A_i= A_1 \cup A_2 \cup \ldots \cup A_r. $$ The set $A$ consists of all prime numbers $\leq \sqrt{N}$ and all numbers deleted in the sieve of Eratosthenes.

So $A^\complement$ is the set of prime numbers $>\sqrt{N}$.

Consequently, the number $|A|$ of elements of $A$ is given by the equation $$ N-1-|A|+\pi(\sqrt{N})=\pi(N). $$ Now, according to a well-known counting formula for finite sets \begin{align*} |A|\hspace{0.25cm} & =\hspace{0.25cm} | A_1 \cup A_2 \cup \cdots \cup A_r | \\ & =\hspace{0.25cm} \textstyle\sum\limits_{1 \leq i \leq r}\left|A_i\right|\hspace{0.25cm} \begin{aligned}[t] & - \textstyle\sum\limits_{1 \leq i_1<i_2 \leq r}\left|A_{i_1} \cap A_{i_2}\right| \\ & + \textstyle\sum\limits_{1 \leq i_1<i_2<i_3 \leq r}\left|A_{i_1} \cap A_{i_2} \cap A_{i_3}\right| \\ & - \cdots + (-1)^{r-1}\left|A_1 \cap A_2 \cap \cdots \cap A_r\right|. \end{aligned} \end{align*} Because of $$ \left|A_{i_1} \cap A_{i_2} \cap \ldots \cap A_{i_s}\right|=\left\lfloor\frac{N}{p_{i_1} p_{i_2} \ldots p_{i_s}}\right\rfloor \text { and } N=\left\lfloor\frac{N}{1}\right\rfloor, $$ the specified formula follows.