%! TEX root = NT.tex
% vim: tw=50
% 10/11/2023 10AM

\begin{flashcard}[legendres-formula-prop]
\begin{proposition}[Legendre's Formula]
  \label{legendres_formula}
  \cloze{
  Let $X > 1$. Then
  \[ \pc(x) - \pc(\sqrt{x}) + 1 = \#\{1 \le n \le
  x \st \gcdbrack(n, P) = 1\} = \sum_{d \divides
  P} \mobius(d) \left\lfloor \frac{x}{d} \right\rfloor \]
  where
  \[ P = \prod_{\substack{p \le \sqrt{x} \\
  \text{\gls{prime}}}} p ,\]
  and $\mobius$ is the \gls{mobius_function}.
  }
\end{proposition}

\begin{proof}
  \cloze{
  If $n \in \NN$, $n > 1$, $n \le x$, then $n$ is
  \gls{prime} if and only if there does not exist a
  \gls{prime} $q \le \sqrt{x}$ such that $q \mid n$ (if
  $n = ab$ with $a \le b$ then $a \le \sqrt{x}$).
  So
  \begin{align*}
    \{1 \le n \le x \st \gcdbrack(n, P) = 1\}
    &= \{1\} \cup \{p \le x \text{ \gls{prime}}
    \st \gcdbrack(p, P) = 1\} \\
    &= \{1\} \cup \{p \le x \text{ \gls{prime}}
    \st p > \sqrt{x}\}
  \end{align*}
  and
  \[ \#\{1 \le n \le x \st \gcdbrack(n, P) = 1\} =
  1 + \pc(x) - \pc(\sqrt{x}) .\]
  Last time we showed that if $n \in \NN$, then
  \[ \sum_{d \divides n} \mobius(d) = \begin{cases}
    1 & n = 1 \\
    0 & n > 1
  \end{cases} \]
  So
  \begin{align*}
    \#\{1 \le n \le x \st \gcdbrack(n, P) = 1\}
    &= \sum_{1 \le n \le x} \sum_{d \divides
    \gcdbrack(n, P)} \mobius(d) \\
    &= \sum_{d \divides P} \mobius(d)
    \sum_{\substack{1 \le n \le x \\ d \divides
    n}} 1 \\
    &= \sum_{d \divides P} \mobius(d) \left\lfloor
    \frac{x}{d} \right\rfloor \qedhere
  \end{align*}
  }
\end{proof}
\end{flashcard}

\begin{flashcard}[vp-defn]
\begin{definition}
  \glssymboldefn{p_adic}{$\nu_p$}{$\nu_p$}
  Let $N \in \NN$, $p$ a \gls{prime} number. Then
  \[ \nu_p(N) = \cloze{\text{$p$-adic valuation of
  $N$}}
  = \cloze{\text{exponent of $p$ in \gls{prime}
  factorisation of $N$}} .\]
  \cloze{So $N = p^{\nu_p(N)} N_1$, $N_1 \in \NN$,
  $\gcdbrack(p, N_1) = 1$.}
\end{definition}
\end{flashcard}

\begin{note*}
  $\padic_p(N) = 0 \iff p \ndivides N$. If $N, M \in
  \NN$, then $\padic_p(NM) = \padic_p(N) + \padic_p(M)$.
\end{note*}

\begin{lemma}
  \label{chebyshev_lemmas}
  Let $n \in \NN$, $N = {2n \choose n} =
  \frac{(2n)!}{(n!)^2}$. Then:
  \begin{enumerate}[(1)]
    \item $\frac{2^{2n}}{2n} \le N < 2^{2n}$.
    \item If $p$ is \gls{prime}, and $n < p \le
      2n$, then $\padic_p(N) = 1$.
    \item If $p$ is an odd \gls{prime}, and
      $\frac{2n}{3} < p \le n$, then $\padic_p(N)
      = 0$.
    \item For any \gls{prime} $p$,
      $p^{\padic_p(N)} \le 2n$.
  \end{enumerate}
\end{lemma}

\begin{proof}
  \phantom{}
  \begin{enumerate}[(1)]
    \item $2^{2n} = (1 + 1)^{2n} = \sum_{i =
      0}^{2n} {2n \choose i} = 2 + \sum_{i =
      1}^{2n - 1} {2n \choose i} \ge 2 + {2n
      \choose n} = 2 + N$. Hence $N < 2^{2n}$. If
      $1 \le i \le 2n - 1$, then ${2n \choose i}
      \le {2n \choose n}$. So
      \[ 2^{2n} \le 2 + (2n - 1) {2n \choose n}
      \le (2n) {2n \choose n} = 2nN .\]
      Therefore $N \ge \frac{2^{2n}}{2n}$.
    \item \[ {2n \choose n} = \frac{(2n)(2n - 1)
      \cdots (n + 1)}{(n)(n - 1) \cdots (1)} \]
      $n < p \le 2n$ $\implies$ $p$ does not
      divide the denominator. Also, there's
      exactly one multiple of $p$ in the
      numerator, namely $p$ itself. So
      \[ \padic_p(N) = \ub{\padic_p((2n) \cdots (n +
      1))}_{=1} - \ub{\padic_p(n(n - 1) \cdots
      (1))}_{=0} .\]
    \item Now $p$ is an odd prime with
      $\frac{2n}{3} < p \le n$. So $\frac{4n}{3} <
      2p \le 2n$, $2n < 3p$. So in
      \[ {2n \choose n} = \frac{(2n)(2n - 1)
      \cdots (n + 1)}{(n)(n - 1) \cdots (1)} \]
      the only multiple of $p$ in the denominator
      is $p$, and the only multiple of $p$ in the
      numerator is $2p$. So
      \[ \padic_p(N) = \padic_p(2p) - \padic_p(p)
      = 1 - 1 = 0 \]
      as $p$ is odd.
    \item We will use the formula ($n \in \NN$,
      $p$ \gls{prime}),
      \[ \padic_p(n!) = \sum_{i = 1}^\infty
      \left\lfloor \frac{n}{p^i} \right\rfloor \]
      (to be proved on \es{3}). Note the sum is
      finite as when $p^i > n$, $\frac{n}{p^i} <
      1$ so $\left\lfloor \frac{n}{p^i}
      \right\rfloor = 0$. We want to show that
      $p^{\padic_p(N)} \le 2n$, or that is $k \ge
      0$, and $p^k \divides N$, then $p^k \le
      2n$. We'll show instead that if $p^k > 2n$,
      then $p^k \ndivides N$. We have
      \begin{align*}
        \padic_p(N)
        &= \padic_p((2n)!) - 2\padic_p(n!) \\
        &= \sum_{i = 1}^\infty \left( \left\lfloor
        \frac{2n}{p^i} \right\rfloor - 2
        \left\lfloor \frac{n}{p^2} \right\rfloor
        \right)
      \end{align*}
      If $p^k > 2n$, then this equals
      \[ \sum_{i = 1}^{k - 1} \left( \left\lfloor
      \frac{2n}{p^i} \right\rfloor - 2
      \left\lfloor \frac{n}{p^i} \right\rfloor \right) \]
      (since if $i \ge k$ then $p^i > 2n$
      $\implies$ $\frac{2n}{p_i} < 1$, so
      $\left\lfloor \frac{2n}{p^i} \right\rfloor =
      0$). If $x \in \RR$, $x > 0$, then
      $\left\lfloor 2x \right\rfloor - 2
      \left\lfloor x \right\rfloor \in \{0, 1\}$.
      Why? If $x = m + \alpha$, $m \in \ZZ$,
      $\alpha \in [0, 1)$, then $\left\lfloor x
      \right\rfloor = m$, $2x = 2m + 2\alpha$, so
      \[ \left\lfloor 2x \right\rfloor = \begin{cases}
        2m & \alpha \in \left[0, \half\right) \\
        2m + 1 & \alpha \in \left[\half, 1\right)
      \end{cases} \]
      So
      \[ \left\lfloor 2x \right\rfloor - 2
      \left\lfloor x \right\rfloor = \begin{cases}
        0 & \alpha \in \left[0, \half \right) \\
        1 & \alpha \in \left[\half, 1\right)
      \end{cases} \]
      So
      \[ \padic_p(N) = \sum_{i = 1}^{k - 1} \left(
      \left\lfloor \frac{2n}{p^i} \right\rfloor -
      2 \left\lfloor \frac{n}{p^i}
      \right\rfloor\right) \le k - 1 .\]
      So $p^k \ndivides N$. \qedhere
  \end{enumerate}
\end{proof}

\begin{theorem}[Chebyshev's Theorem]
  \label{chebyshevs_thm}
  There exist $c_1, c_2 > 0$ such that $\forall x
  > 4$,
  \[ c_1 \frac{x}{\log x} \le \pc(x) \le c_2
  \frac{x}{\log x} .\]
\end{theorem}
\vspace{-1em}

The proof will show we can take $c_1 = \frac{\log
2}{2}$, $c_2 = 6\log 2$.

\begin{proof}
  Strategy: prove bounds that work for certain
  integer values of $x$, and then interpolate to
  all $x > 4$.

  We first prove the upper bound.

  \textbf{Claim:} If $k \ge 1$, $\pc(2^k) \le
  \frac{3 \times 2^k}{k}$. Note that if $n \in
  \NN$, then $\pc(2n) \le n$ (as \glspl{prime} are
  among $2, 3, 5, 6, \ldots$). We have
  \[ \frac{2^k}{k} = 2^{k - 1} \le \frac{3 \times
  2^k}{k} \iff k \le 6 .\]
  So the claim holds if $k \le 6$. Now suppose the
  claim holds for some $k \ge 5$, and let $n =
  2^k$, $N = {2n \choose n}$. Then
  \begin{align*}
    2^{2n}
    &> N \\
    &&\text{(\cref{chebyshev_lemmas}(1))} \\
    &\ge \prod_{\substack{n < p \le 2n
    \\ \text{$p$ \gls{prime}}}} p
    &&\text{(\cref{chebyshev_lemmas}(2))} \\
    &\ge \prod_{\substack{n < p \le 2n \\ \text{$p$
    \gls{prime}}}} n
    &&\text{($p \ge n$)} \\
    &= n^{\pc(2n) - \pc(n)}
  \end{align*}
  So
  \[ \pc(2n) - \pc(n) = \pc(2^{k + 1}) - \pc(2^k)
  \le \frac{\log 2^{2n}}{\log n} = \frac{2n \log
  2}{\log 2^k} = \frac{2^{k + 1}}{k} .\]
  Rearrange:
  \[ \pc(2^k + 1) \le \pc(2^k) + \frac{2^{k +
  1}}{k} \le \frac{3 \times 2^k}{k} + \frac{2^{k +
  1}}{k} = \frac{5 \cdot 2^k}{k} \]
  We have
  \[ \frac{5 \times 2^k}{k} \le \frac{3 \times
  2^{k + 1}}{k + 1} \iff 5(k + 1) \le 6k \iff k \ge
  5 \]
  This proves the claim. Rest of proof next time.
  \renewcommand\qed{}
\end{proof}
