Solution
= Solution
For prime $n$, pair each nonzero residue with its inverse; only $\pm1$ are self-inverse, yielding <Wilson theorem>. Conversely, if $(n-1)!\equiv-1\pmod n$, every $1\le a\lt n$ is a unit (otherwise a common divisor would divide the left side and $n$ but not $-1$), so $n$ is prime.