# Show that $a^{(p-1)!+1} \equiv a \mod p$

I'm working in the following excercise:

Show that $$a^{(p-1)!+1} \equiv a \mod p$$

By Wilson's theorem I have:

$$a^{(p-1)!} \equiv -1 \mod p$$ $$a^{(p-1)!} * a \equiv -1 * a\mod p$$ $$a^{(p-1)!+1} \equiv -a \mod p$$ $$a^{(p-1)!+1} \equiv a \mod p$$

I'm not sure about my proof, is that correct? any help will be really appreciated.

• Why can you suddenly rid of the minus sign? – Randall Jan 30 '19 at 22:05
• How can you justify that $-a\equiv a \pmod p$? – fleablood Jan 30 '19 at 22:06
• How does wilson's th which states $(p-1)! \equiv -1 \pmod p$ make you assume $a^{(p-1)!}\equiv a \pmod p$? – fleablood Jan 30 '19 at 22:08

Actually it is $$a^{(p-1)!} \equiv 1$$ mod $$p$$ (not $$-1$$). Indeed, $$a^{k(p-1)} \equiv 1$$ for any integer $$k$$, as $$|(\mathbb{F}_p)^{\times}| = p-1.$$
[In general, let $$G$$ be any group. Then for every element $$g \in G$$, the equation $$g^{k|G|} = e$$ holds for any positive integer $$k$$, where $$e$$ is the identity element. Here set $$G = (\mathbb{F}_p)^{\times}$$ where the operation is multiplcation.]