Wilson's Theorem - Gauss's Generalization

Gauss's Generalization

Gauss proved that if m > 2


\prod_{k = 1 \atop \gcd(k,m)=1}^{m} \!\!k \ \equiv
\begin{cases}
-1 \pmod{m} & \text{if } m=4,\;p^\alpha,\;2p^\alpha \\
\;\;\,1 \pmod{m} & \text{otherwise}
\end{cases}

where p is an odd prime, and is a positive integer. The values of m for which the product is −1 are precisely the ones where there is a primitive root (mod m).

This further generalizes to the fact that in any finite abelian group, either the product of all elements is the identity, or there is precisely one element a of order 2 (but not both). In the latter case, the product of all elements equals a.

Read more about this topic:  Wilson's Theorem