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}$
| k | S_k |
| 0 | 4 |
| 1 | 14 |
| 2 | 194 |
| 3 | 4870 |
| 4 | 3953 |
| 5 | 5970 |
| 6 | 1857 |
| 7 | 36 |
| 8 | 1294 |
| 9 | 3470 |
| 10 | 128 |
| 11 | 0 |
We have shown $S_{11} \equiv 0 \pmod {8191}$, which means $M_{13}=2^{13}-1$ is prime.