Solution (source code)

= Solution
{c}

<Wilson's theorem> states that an integer $p>1$ is prime if and only if
$$
\boxed{(p-1)!\equiv-1\pmod p.}
$$
In particular the congruence holds for every prime $p$, including two.