Find $$(1008)!\equiv ? \pmod {2017}$$
From the Wilson theorem I can $2016!\equiv -1\pmod{2017}$
Considering the general: $$\left(\dfrac{p-1}{2}\right)!\equiv ?\pmod p$$ where $p$ is prime number
Find $$(1008)!\equiv ? \pmod {2017}$$
From the Wilson theorem I can $2016!\equiv -1\pmod{2017}$
Considering the general: $$\left(\dfrac{p-1}{2}\right)!\equiv ?\pmod p$$ where $p$ is prime number
$(p-1)!=1\cdot2\cdots\frac{p-1}{2}\cdot\frac{p+1}{2}\cdots(p-2)(p-1)$ and $(p-1)!\equiv 1\cdot(-1)\cdot2\cdot(-2)\cdots\frac{p-1}{2}\cdot\left(-\frac{p-1}{2}\right)\pmod p.$
From Wilson's theorem, $(p-1)!\equiv -1\pmod{p}$
Implies $\left[\left(\frac{p-1}{2}\right)!\right]^{2}\equiv (-1)^{\frac{p+1}{2}}\pmod{p}$