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

\begin{example*}
  Is $2$ a \gls{prim_root} \gls{modulo} $p = 19$?
  $\totient(p) = 18$, so if $d$ is the order of $2$
  \gls{modulo} $19$, then $d \divides 18$ and
  \[ d = 18 \iff
  \text{$2$ is a \gls{prim_root} \gls{modulo} $19$} \]
  The divisors of $18$ are $1$, $3$, $9$, $2$,
  $6$ and $18$. So $2$ is a \gls{prim_root} if and
  only if $2^6 \not\equiv 1 \pmod{19}$ and $2^9
  \not\equiv 1 \pmod{19}$.
  \begin{align*}
    2^4 = 16 
    &\equiv -3 \pmod{19} \\
    2^6 \equiv -12
    \not\equiv 1 \pmod{19} \\
    2^9 = 8 \times 2^6
    \equiv 56 \equiv -1 \not\equiv 1 \pmod{19}
  \end{align*}
  So $2$ is a \gls{prim_root} \gls{modulo} $p$.
\end{example*}

\begin{remark*}
  If $p$ is a \gls{prime} number, $a \in \ZZ$, then $a$
  is a \gls{prim_root} \gls{modulo} $p$ if and only if
  \[ a^{\frac{p - 1}{q}} \not\equiv 1 \pmod{p}
  \qquad \forall \text{\gls{prime} divisors $q$ of $p -
  1$} \]
  Checking this requires knowing the
  \gls{prime_factorisation} of $p - 1$.

  There is no known \gls{poly_time} algorithm for
  finding a \gls{prim_root} \gls{modulo} $a$ given
  \gls{prime}
  $p$. One can show that, assuming GRH
  (generalised Riemann hypothesis), there exists
  $c > 0$ such that for any \gls{prime} number $p$,
  there exists $a \in \ZZ$, $1 \le a \le c(\log
  p)^6$ such that $a$ is a \gls{prim_root}
  \gls{modulo} $p$.
\end{remark*}

\begin{flashcard}[p-to-the-k-is-cyclic]
\begin{theorem}
  \label{Zpk_cyclic}
  \cloze{Let $p$ be an odd \gls{prime}, $k \in
  \NN$.} Then $\multbrack(\ZZ / p^k\ZZ)$ is cyclic.
\end{theorem}
\end{flashcard}

\begin{remark*}
  The corresponding statement is false for $p =
  2$, on $\multbrack(\ZZ / 8\ZZ) \simeq C_2 \times
  C_2$ which is not cyclic.
\end{remark*}

\begin{lemma}
  \label{lemma_124}
  Let $p$ be an odd \gls{prime}, $k \in \NN$, $x, y \in
  \ZZ$. Then:
  \begin{enumerate}[(1)]
    \item If $x \equiv 1 + p^k y \pmod{p^{k +
      1}}$, then $x^p \equiv 1 + p^{k + 1} y
      \pmod{p^{k + 2}}$.
    \item $(1 + py)^{p^k} \equiv 1 + p^{k + 1} y
      \pmod{p^{k + 2}}$.
  \end{enumerate}
\end{lemma}

\begin{proof}
  \begin{enumerate}[(1)]
    \item Note that
      $x = 1 + p^k y + p^{k + 1} z$ for some $z
      \in \ZZ$. Then
      \[ x^p = (1 + p^k y)^p + \sum_{j = 1}^p {p
      \choose j} (1 + p^k y)^{p - j} (p^{k + 1}
      z)^j \]
      If $1 \le j \le p - 1$, then $p \divides {p
      \choose j}$, so $p \cdot p^{k + 1} \divides {p
      \choose j} (p^{k + 1} z)^j$. For $j = p$,
      $(p^{k + 1} z)^p = p^{pk + p} z^p$. Since
      $pk + p \ge k + 2$, $p^{k + 2} \divides (p^{k +
      1} z)^p$. So each term of the sum is $0
      \pmod{p^{k + 2}}$, so $x^p \equiv (1 + p^k
      y)^p \pmod{p^{k + 2}}$. Now we compute:
      \[ (1 + p^k y)^p = 1 + p^{k + 1} y + \sum_{j
      = 2}^p {p \choose j} (p^k y)^j \]
      If $2 \le j \le p - 1$, then $p \divides {p
      \choose j}$, so $p^{2k + 1} \divides {p \choose
      j} (p^k y)^j$. We have $2k + 1 \ge k + 2
      \iff k \ge 1$, so $p^{k + 2} \divides {p \choose
      j} (p^k y)^j$. $(p^k y)^p = p^{pk} y^p$. We
      have $pk \ge k + 2 \iff (p - 1)k \ge 2$.
      We're assuming $p$ is odd, so $p - 1 \ge 2$,
      so $(p - 1)k \ge 2$. So all the terms in the
      sum are divisible by $p^{k + 2}$, so $x^p
      \equiv 1 + p^{k + 1} y \pmod{p^{k + 2}}$ as desired.
    \item Apply part (1) $k$ times to $1 + py,
      (1 + py)^p, \ldots$. \qedhere
  \end{enumerate}
\end{proof}

\begin{lemma}
  \label{lemma_125}
  Let $p$ be an odd \gls{prime}, $k \ge 2$, $a \in \ZZ$.
  If $a$ is a \gls{prim_root} \gls{modulo} $p$ but $a^{p
  - 1} \not\equiv 1 \pmod{p^2}$, then $a$
  generates $\multbrack(\ZZ / p^k \ZZ)$.
\end{lemma}

\begin{proof}
  Let $d$ be the order of $a \in \multbrack(\ZZ /
  p^k\ZZ)$. Then $d \divides \totient(p^k) = p^{k -
  1}(p - 1)$. We know $a^d \equiv 1 \pmod{p^k}
  \implies a^d \equiv 1 \pmod{p}$, so $p - 1
  \divides
  d$ (since $a$ is a \gls{prim_root} \gls{modulo} $p$).
  We must have $d = p^j (p - 1)$ for some $0 \le j
  \le k - 1$. Need to show $j = k - 1$. We can
  write $a^{p - 1} = 1 + py$ with $y \in \ZZ$,
  $\gcdbrack(p, y) = 1$ (as $a^{p - 1} \not\equiv 1
  \pmod{p^2}$). So
  \begin{align*}
    a^{(p - 1)p^{k - 2}} = (1 + py)^{p^{k - 2}}
    &\equiv 1 + p^{k - 1} y \pmod{p^k}
    &&\text{by \cref{lemma_124}(2)} \\
    &\not\equiv 1 \pmod{p^k}
  \end{align*}
  So $d \ndivides (p - 1) p^{k - 2}$. This forces $d =
  (p - 1)p^{k - 1}$, so $a$ generates $\multbrack(\ZZ / p^k
  \ZZ)$.
\end{proof}

We can now prove \cref{Zpk_cyclic} (i.e.
$\multbrack(\ZZ / p^k\ZZ)$ is
cyclic when $p$ is odd):

\begin{proof}
  We can assume $k \ge 2$. Let $a \in \ZZ$ be a
  \gls{prim_root} \gls{modulo} $p$. If $a^{p - 1}
  \not\equiv 1 \pmod{p^2}$, then $a \pmod{p^k}$
  generates $\multbrack(\ZZ / p^k\ZZ)$, and we're
  done. So suppose $a^{p - 1} \equiv 1
  \pmod{p^2}$, and let $b = (1 + p)a$.

  \textbf{Claim:} $b \pmod{p^k}$ generates
  $\multbrack(\ZZ / p^k\ZZ)$.

  Since $b \equiv a \pmod{p}$,
  $b$ is a \gls{prim_root} \gls{modulo} $p$. By
  \cref{lemma_125}, the claim is true if $b^{p -
  1} \not\equiv 1 \pmod{p^2}$, or equivalently if
  $b^p \not\equiv b \pmod{p^2}$. We compute
  \[ b^p = (1 + p)^p a^p \equiv a^p \pmod{p^2} \]
  We're assuming that $a^p \equiv a \pmod{p^2}$,
  so $b^p \equiv a \pmod{p}^2$. By construction we
  have $b \not\equiv a \pmod{p}^2$, so $b^p
  \not\equiv b \pmod{p^2}$, so the claim is true.
\end{proof}

\begin{example*}
  In last lecture, we saw that $2$ is not a
  \gls{prim_root} \gls{modulo} $7$, but $3$ is. Does $3
  \pmod{7^k}$ generate $\multbrack(\ZZ / 7^k \ZZ)$
  for all $k > 1$? This is true if and only if
  $3^6 \not\equiv 1 \pmod{49}$.
  \[ 3^4 = 81 = 100 - 19 = 98 + 2 - 19 \equiv -17
  \pmod{49} \]
  $17 \times 3 = 51 \equiv 2 \pmod{49}$, so
  $3^5 \equiv -2 \pmod{49}$
  so $3^6 \equiv -6 \not\equiv 1 \pmod{49}$. So
  $3 \pmod{7^k}$ does generate the group for all
  $k \ge 1$.
\end{example*}

\begin{remark*}
  What happens when $p = 2$? \cref{lemma_124}(1)
  fails when $p = 2$, $k = 1$ ($(1 + 2)^2 \equiv 1
  \pmod{8}$). It does hold when
  $k \ge 2$. Using this, you can show that
  \[ \ker(\multbrack(\ZZ / 2^k \ZZ) \to \multbrack(\ZZ /
  4\ZZ)) \]
  is cyclic when $k \ge 2$, of order $2^{k - 2}$.
  Using this one can show that there's an
  isomorphism $\multbrack(\ZZ / 2^k\ZZ) \simeq
  C_{2^{k - 2}} \times C_2$, with generators $5$,
  $-1$ modulo $2^k$.
\end{remark*}
