[Math] Find the remainder when $15!$ is divided by $31$.

elementary-number-theory

Find the remainder when $15!$ is divided by $31$. I know I have to apply Wilsons theorem but i am a little confused how.

Best Answer

By Wilson's Theorem, we know that $30!\equiv-1$ (mod 31). Now lets look at the extra factors that are multiplied to turn $15!$ into $30!$.

$16\equiv -15$ (mod 31), $17\equiv -14$ (mod 31), $\ldots, 30\equiv -1$ (mod 31)

Thus $\frac{30!}{15!}\equiv (-1)^{30-15}\cdot 15!=-15!$ (mod 31)

Thus we get $$-1\equiv 30!=15!\frac{30!}{15!}\equiv -1\cdot (15!)^2\Rightarrow 15!=\pm1\text{ (mod 31)}$$

Which one do you think it is?