Thursday, 29 January 2026

Exercise (4.5).1

By applying the Lucas–Lehmer test, determine the primality of $M_{13} = 2^{13} - 1$.


The Lucas-Lehmer test states that the Mersenne number $M_p = 2^p - 1$ is prime if and only if $S_{p−2} \equiv 0 \pmod {M_p}$ where $S_k$ is defined as the least non-negative residue such that $S_0 = 4$ and $S_k ≡ S^2_{k−1}− 2 \pmod {M_p}$ for integer $k \ge 1$.


This definition is recursive. We'll start with

$$ S_0 = 4 $$

Noting $M_{13}=2^{13}-1 = 8191$, we then have

$$ \begin{align} S_1 & \equiv S^2_{0} -2 \pmod {8191} \\ \\ & \equiv (4)^2 -2 \pmod {8191} \\ \\ & \equiv 14 \pmod {8191} \end{align} $$

Continuing

$$ \begin{align} S_2 & \equiv S^2_{1} -2 \pmod {8191} \\ \\ & \equiv (14)^2 -2 \pmod {M_{13}} \\ \\ & \equiv 194 \pmod {8191} \end{align} $$

Similarly

$$ \begin{align} S_4 & \equiv 37634 \pmod {8191} \\ \\ & \equiv 4870 \pmod {8191} \end{align} $$

We continue in this manner until $S_{11}$

kS_k
04
114
2194
34870
43953
55970
61857
736
81294
93470
10128
110


We have shown $S_{11} \equiv 0 \pmod {8191}$, which means $M_{13}=2^{13}-1$ is prime.