%! TEX root = AN.tex
% vim: tw=50
% 07/02/2025 09AM

\subsection{Sieve Methods}

\begin{itemize}
  \item General tools for estimating the number of
    primes (or products of a few primes in a set).
  \item Need information on the distribution of
    the set in residue classes.
\end{itemize}

\begin{fcdefnstar}[Sieve problem]
  \glssymboldefn{sieve}%
  Let $\mathcal{P} \subseteq \Pbb$. Let
  \[
    P(z) = \prod_{\substack{p \in \mathcal{P} \\ p \le z}} p
  ,\]
  and let $A \subseteq \Zbb$. Denote
  \[
    S(A, \mathcal{P}, z) = |\{n \in A : (n, P(z))
    = 1\}|
  .\]
\end{fcdefnstar}

Problem: Estimate $\sieve(A, \mathcal{P}, z)$.

Note
that if $A \subseteq \left[ \frac{x}{2}, x \right]
\cap \Zbb$,
\begin{align*}
  \sieve(A, \Pbb, x^{\half})
  &= |A \cap \Pbb| \\
  \sieve(A, \Pbb, x^{\third})
  &= |A \cap (\Pbb \cup \{p_1 p_2 : p_1 p_2 >
  x^{\third}\})|
\end{align*}

\glsnoundefn{sievehyp}{sieve hypothesis}{NA}%
\textbf{Sieve hypothesis:} There exists a
multiplicative $g : \Nbb \to [0, 1]$ and $R_d \in
\Rbb$ such that
\[
  |\{n \in A : n \equiv 0 \pmod d\}| = g(d)|A| +
  R_d
\]
for all square-free $d$ (no repeated prime
factors).

\begin{example*}
  \phantom{}
  \begin{itemize}
    \item $A = [1, x]$, $\mathcal{P} = \Pbb$.
      \[
        |A_d| = \left\lfloor \frac{x}{d} \right\rfloor
        = \frac{x}{d} + O(1)
      \]
      Then $g(d) = \frac{1}{d}$, $|R_d| \vll 1$.
      \[
        \sieve(A, \Pbb, x^{\half})
        = |\{p \in \Pbb : p \in [x^{\half}, x]\}|
        = \pi(x) + O(x^{\half})
      .\]
    \item $A = \{n(n + 2) : n \le x\}$,
      $\mathcal{P} = \Pbb$. Let $d = p_1 \cdots
      p_r$, where $p_i$ are distinct primes. Then
      \begin{align*}
        |A_d|
        &= |\{n \le x : n \equiv 0 \text{ or } -2
        \pmod{p_i} \forall i \le r\}| \\
        &= \begin{cases}
          \frac{2^r}{d}x
          & \text{if $d$ odd} \\
          \frac{2^{r - 1}}{d}x + O(2^r)
          & \text{if $d$ even}
        \end{cases}
      \end{align*}
      (by Chinese Remainder Theorem).
      \begin{align*}
        \sieve(A, \Pbb, (2x)^{\frac{n}{2}})
        &= |\{p \in ((2x)^{\half}, x] : p + 2 \in
        \Pbb\}| \\
        &= |\{p \le x : p + 2 \in \Pbb\}| +
        O(x^{\half})
      \end{align*}
      Here,
      \[
        g(p) = \begin{cases}
          \frac{1}{p} & p = 2 \\
          \frac{2}{p} & p > 2
        \end{cases}
      \]
      and $R_d = O(2^{w(d)})$, where $w(d)$ is the
      number of prime factors of $d$ (distinct).
  \end{itemize}
\end{example*}

\begin{fclemmastar}[]
  We have
  \[
    \sieve(A, \mathcal{P}, z)
    = \sum_{d \mid P(z)} \mu(d) |A_d|
  .\]
\end{fclemmastar}

\begin{proof}
  Recall that
  \[
    \indicator{n = 1} = (\mu \conv 1)(n)
  \]
  (since $\mu$ is the inverse of $1$). Hence,
  \begin{align*}
    \sieve(A, \mathcal{P}, z)
    &= \sum_{n \in A} \indicator{(n, P(z)) = 1} \\
    &= \sum_{n \in A} \sum_{\substack{d \mid P(z)
    \\ d \mid n}} \mu(d) \\
    &= \sum_{d \mid P(z)} \mu(a) |A_d| \qedhere
  \end{align*}
\end{proof}

\begin{example*}
  Let
  \[
    \pi(x, z) = |\{n \le x : (n, P(z)) = 1\}|
  .\]
  Let $\mathcal{P} = \Pbb$.
  Let $A = [1, x] \cap \Zbb$. Then
  \[
    |A_d| = \frac{x}{d} + O(1)
  .\]
  By the previous lemma,
  \begin{align*}
    \pi(x, z)
    &= \sieve(A, \Pbb, z) \\
    &= \sum_{d \mid P(z)} \mu(d) \left( \frac{x}{d}
    + O(1) \right) \\
    &= x \sum_{d \mid P(z)} \frac{\mu(d)}{d} + O
    \left( \sum_{d \mid P(z)} \ub{|\mu(d)|}_{\le
    1} \right) \\
    &= x \sum_{d \mid P(z)} \frac{\mu(d)}{d} +
    O(2^{\pi(z)})
    &&\text{$P(z) = p_1 \cdots p_{\pi(2)}$}
    \\
    &= x \prod_{p \le z} \left( 1 +
    \ub{\frac{\mu(p)}{p}}_{-1} \right)
    + O(2^{\pi(2)})
    &&\text{fundamental theorem of arithmetic} \\
    &= \frac{c + o(1)}{\log z} x + O(2^z)
    &&\text{Merten's theorem, for some $c > 0$}
  \end{align*}
  For $2 \le z \le \log x$,
  \[
    \pi(x, z)
    = \frac{c + o(1)}{\log z} x
  .\]
\end{example*}

\begin{fcthmstar}[Sieve of Erastothenes --
  Legendre]
  Assuming:
  - $A \subseteq [1, x] \cap \Nbb$
  - $2 \le z \le x$
  - Assume the Sieve Hypothesis
  Then:
  \begin{align*}
    &S(A, \mathcal{P}, z) \\
    &= |A| \prod_{\substack{p
    \le 2 \\ p \in \mathcal{P}}} (1 - g(p))
    + O\left(x^{\half} (\log x)^{\half}2^{-\frac{\log
    x}{4 \log z}} \left( \sum_{\substack{d \le x \\
    d \mid P(z)}} |R_d|^2
    \right)^{\frac{1}{2}} + |A| e^{\frac{\log
    x}{\log z}} \prod_{\substack{p \le z \\ p \in
    \mathcal{P}}} (1 + g(p))^e\right)
  \end{align*}
\end{fcthmstar}
