Does anyone know how to prove the following theorem:

If $g$ is a primitive root modulo $p$ (and $p$ is a prime number), then
$$(p-1)! \equiv g^{p(p-1)/2} \pmod{p}.$$


Hint: $$\sum_{k=1}^{p-1}k=\frac{p(p-1)}{2}$$


Clear for $p=2$. Assume $p\ge 3$.

$g$ being a primitive root mod $p$ means (by definition) $\text{ord}_p (g)=p-1$, i.e. $p-1$ is the smallest $k\ge 1$ such that $g^k\equiv 1\,\pmod{\! p}$.

$$g^{p-1}\equiv 1\,\pmod{\! p}\iff g^{(p-1)/2}\equiv \pm 1\,\pmod{\! p},$$

but since $1\le (p-1)/2<p-1$, we have $g^{(p-1)/2}\equiv -1\pmod{\! p}$.

Then $g^{p(p-1)/2}\equiv (g^{(p-1)/2})^p\equiv (-1)^p\equiv -1\,\pmod{\! p}$, which is equivalent to $(p-1)!$ by Wilson's theorem.

Above I used $a^2\equiv 1\iff a\equiv \pm 1\,\pmod{\! p}$, which is true because by Euclid's lemma:

$$p\mid a^2-1=(a+1)(a-1)\iff (p\mid a+1\ \ \text{ or }\ \ p\mid a-1)$$


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.