Prove $(n-1)! = -1 \ (\textrm{mod n})$ iff n is prime
I can understand how the first part of the proof $(n-1)!=-1 \ (\textrm{mod n})$ is true if n is prime simply by testing it out. However, I'm unsure of how to go about proving it.
Prove $(n-1)! = -1 \ (\textrm{mod n})$ iff n is prime
I can understand how the first part of the proof $(n-1)!=-1 \ (\textrm{mod n})$ is true if n is prime simply by testing it out. However, I'm unsure of how to go about proving it.
Notice $(n-1)! = 1 \cdot 2 \cdot 3 \cdot \cdots \cdot n-1$ and, ignoring $1$, each number on that list has a distinct (why?) multiplicative inverse (why?) on that list except ...
... $-1 \cong n-1$ because it is its own inverse.
Hint: If $n$ is prime then $\mathbb{Z}_n$ is a group i.e every element has an inverse. Also, if we know $n$ isprime (assume $>2$) then $n$ is odd. You have;
$$(n-1)! = (n-1)(n-2)(n-3) \cdots 3 \cdot 2$$
The union of all the elements above is $\mathbb{Z}_n$.