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

Which integers are \glsref[bqf_rep]{represented}
by $f(x, y) = x^2 +
xy + 2y^2$? If $m, n \in \ZZ$, not both $0$, then
$m = dm_1$, $n = dn_1$, $d = \gcd(m,n)$, and then
$\gcdbrack(m_1, n_1) = 1$. So
\[ f(m, n) = f(dm_1, dn_1) = d^2 f(m_1, n_1) \]
where $f(m_1, n_1)$ is properly represented by
$f$. So $N \in \NN$ is \glsref[bqf_rep]{represented}
by $f$ $\iff$ $N = d^2 N_1$, $d, N_1 \in \NN$,
$N_1$ is \gls{prop_rep} by $f$ $\iff$ if $p
\divides
N$ and $p \equiv \text{$3$, $5$ or $6$} \pmod{7}$,
then $p$ divides $N$ an even number of times (i.e.
$e_p$ is even).

How general is this? Whenever $\clsnum(d) = 1$,
there's a unique \gls{red_pdbqf} \gls{pdbqf} of
\gls{disc_bqf} $d$, and it
\glsref[bqf_rep]{represents} $N$ properly $\iff$
$X^2 \equiv d \pmod{4N}$ is
\glsref[eq_sol]{solvable}. We can do a similar
computation to characterise the integers
\glsref[bqf_rep]{represented} by this
\gls{red_pdbqf} \gls{pdbqf} in terms of congruence
conditions on \gls{prime} divisors.

If $\clsnum(d) > 1$, then we only have a criterion
for $N$ to be \glsref[bqf_rep]{represented} by
some form of \gls{disc_bqf} $d$. In fact, there do
exist \glspl{pdbqf} $f(x, y)$ such that the set of
\gls{prime} numbers $p$
\glsref[bqf_rep]{represented} by $f$ is not
described by congruence conditions.

\begin{example*}
  $f(x, y) = x^2 + 23y^2$ (this is studied in Part
  III Algebraic Numer Theory).
\end{example*}
\vspace{-1em}

The behaviour of $\clsnum(d)$ as $|d| \to \infty$
is well-studied.
\begin{itemize}
  \item It's known that $\clsnum(d) \to \infty$ as
    $d \to -\infty$ (Siegel, Heilbrown, 1934).
  \item We know $\clsnum(d) = 1$ if and only if
    \[ d = -3, -4, -7, -8, -11, -19, -43, -67,
    -163 \]
    % or
    % \[ d = -12, -16, -27, -28 \]
    (Barker, Stark, 1967).
\end{itemize}
In Part II Number Fields, we define the ideal
class group of a number field $K$. You can show
that if $K = \QQ(\sqrt{d})$, $d < 0$, then there's
a bijection between
\[ \{\text{\glsref[equiv_bqf]{equivalence classes}
of \gls{pdbqf} of \gls{disc_bqf} $D$}\}
\leftrightarrow \{\text{Ideal class group of $K$.}\} \]
$D = \text{discriminant of $K$} = d$, if $d \neq
k^2 d$, $k \in \NN$, $d_1$ a discriminant.

\newpage
\section{Distribution of prime numbers}

We know that there are infinitely many
\glspl{prime}. We'd like to know: what's the
probability that a $50$-digit number if
\gls{prime}?

\begin{flashcard}[pnt-thm]
\begin{theorem}[Prime Number Theorem]
  \label{pnt}
  \glssymboldefn{prime_counting}{$\pi$}{$\pi$}
  \cloze{
  For $X \ge 1$, define $\pc(x) = \#\{\text{$p$
  \gls{prime}} \st p \le x\}$. Then
  \[ \pc(x) \sim \frac{x}{\log x} \]
  as $x \to \infty$.
  }
\end{theorem}
\end{flashcard}
\vspace{-1em}

By definition, we say that $f \sim g$ if $f, g$
are real-valued functions such that
\[ \lim_{x \to \infty} \frac{f(x)}{g(x)} = 1 \]
So \nameref{pnt} says
\[ \lim_{x \to \infty} \frac{\pc(x)}{x / \log(x)}
= 1 .\]
($\log x$ is logarithm to the base $e$).

It's easy to show that $\frac{x}{\log x} \sim
\li(x)$, where
\[ \li(x) \defeq \int_{t = 1}^x \frac{\dd t}{\log
t} ,\]
and in fact $\li(x)$ is a better approximation to
$\pc(x)$ for large values of $x$.

So \nameref{pnt} is equivalent to $\pc(x) \sim
\li(x)$ as $x \to \infty$. This says that the
density of \glspl{prime} close to $x$ is about
$\frac{1}{\log(x)}$. So we expect that the
probability that a random $20$-digit number is
\gls{prime} to be about
\[ \frac{1}{\log(5 \times 10^{19})} = 0.0220\ldots \]
The actual probability is
\[ \frac{\pc(10^{20}) - \pc(10^{19})}{10^{20} -
10^{19}} = 0.0220\ldots \]
Nobody has yet computed $\pc(10^{50})$.

There are many variants of the \nameref{pnt}.

\begin{theorem*}[Dirichlet's Theorem on Primes in
  Arithmetic Progression]
  Take $a, N \in \NN$, $N > 1$, $\gcdbrack(a, N) =
  1$. Then there are infinitely many
  \glspl{prime} $p$ such that $p \equiv a
  \pmod{N}$.
\end{theorem*}

\begin{theorem}
  \label{pnt_modulo}
  \glssymboldefn{prime_counting_modulo}{$\pi$}{$\pi$}
  Let
  \[ \pcmod(a, N, x) = \#\{\text{$p$ \gls{prime}} \st
  p \le x, p \equiv a \pmod{N}\} \]
  Then if $a, N \in \NN$, $N > 1$ and
  $\gcdbrack(a, N) = 1$, then
  \[ \pcmod(a, N, x) \sim \frac{1}{\totient(N)}
  \frac{x}{\log x} \]
  as $x \to \infty$.
\end{theorem}

\begin{corollary*}
  As $x \to \infty$, with appropriate conditions
  on $a$ and $N$,
  \[ \frac{\pcmod(a, N, x)}{\pcmod(x)} \to
  \frac{1}{\totient(x)} .\]
\end{corollary*}
\vspace{-1em}

``A randomly chosen prime lies in any possible
congruence class \gls{modulo} $N$ with probability
$\frac{1}{\totient(N)}$.''

The proofs of these theorems are beyond the scope
of this course. We will:
\begin{itemize}
  \item Inrtoduce Riemann $\zeta$-function and
    Dirichlet series (these are the main tools in
    the proofs of \cref{pnt} and \cref{pnt_modulo}).
  \item Use elementary techniques to prove
    \nameref{chebyshevs_thm}:
    \[ \exists c_1, c_2 > 0 ~\forall x \ge 2,
    \qquad c_1 \frac{x}{\log x} \le \pc(x) \le c_2
    \frac{x}{\log x} \]
\end{itemize}

\begin{lemma}
  If $x \in \NN$, $x > 2$, then
  \[ \pc(x) \ge \frac{\log x}{2\log 2} .\]
\end{lemma}

\begin{proof}
  Let $p_1, \ldots, p_k$ be the \glspl{prime} $\le
  x$. So $k = \pc(x)$. If $1 \le n \le x$, write
  $n = d^2 p_1^{\eps_1} \cdots p_k^{\eps_k}$, $d \in
  \NN$, $\eps_i \in \{0, 1\}$. Each such $n$ has a
  unique expression in this form. We have $d \le
  \sqrt{x}$. So
  \begin{align*}
    x = \#\{n \in \ZZ \st 1 \le n \le x\}
    &\le \sqrt{x} 2^{\pc(x)} \\
    \implies \sqrt{x}
    &\le 2^{\pc(x)} \\
    \implies \half \log x
    &\le \pc(x) \log 2
  \end{align*}
\end{proof}

\begin{proposition}
  \phantom{}
  \begin{enumerate}[(i)]
    \item $\sum_{\text{$p$ \gls{prime}}}
      \frac{1}{p}$ diverges.
    \item $\prod_{\text{$p$ \gls{prime}}} \left( 1
      - \frac{1}{p} \right)^{-1}$ diverges.
  \end{enumerate}
\end{proposition}

\begin{proof}[Proof of (2) $\iff$ (1)]
  Need to show
  \[ \prod_{p \le x} \left( 1 - \frac{1}{p}
  \right)^{-1} \to \infty \]
  as $x \to \infty$. The logarithm of this is
  (recall that the Taylor series for $-\log(1 -
  x)$ is absolutely convergent on $|x| < 1$, and
  $\frac{1}{p} < 1$):
  \begin{align*}
    \log \prod_{p \le x} \left( 1 - \frac{1}{p}
    \right)^{-1}
    &= \sum_{p \le x} -\log \left( 1 - \frac{1}{p}
    \right) \\
    &= \sum_{p \le x} \sum_{k \ge 1}
    \frac{p^{-k}}{k} \\
    &= \sum_{p \le x} \frac{1}{p}
      + \sum_{p \le x} \sum_{k \ge 2}
      \frac{p^{-k}}{k} \\
  \end{align*}
  Claim: $\sum_{p \le x} \sum_{k \ge 2}
  \frac{p^{-k}}{k}$ converges as $x \to \infty$.
  Enough to show these sums are bounded.
  \begin{align*}
    \sum_{p \le x} \sum_{k \ge 2} \frac{p^{-k}}{k}
    &\le \sum_{p \le x} \sum_{k \ge 2} p^{-k} \\
    &= \sum_{p \le x} \frac{p^{-2}}{1 -
    \frac{1}{p}} \\
    &= \sum_{p \le x} \frac{1}{p(p - 1)} \\
    &\le \sum_{n \ge 1} \frac{1}{n^2} \\
    &< \infty
  \end{align*}
  So $\log \prod_{p \le x} \left( 1 - \frac{1}{p}
  \right)^{-1} = \sum_{p \le x} \frac{1}{p} +
  f(x)$ where $f(x)$ converges as $x \to \infty$.
  So (1) $\iff$ (2).
\end{proof}
