1

Let $p$ be a prime number and $r$ an integer such that $1 \le r \lt p$. If $(-1)^rr! \equiv 1 \pmod p$, then $(p-r-1)! \equiv -1 \pmod p$

I know that $n$ is a prime if and only if $(n -2)! \equiv 1 \pmod n$ and Wilson’s theorem: $p$ is a prime if and only if $(p - 1)! \equiv -1 \pmod p$. Still I haven’t found the right relation between them.

I would appreciate some help. Thanks.

1 Answers1

1

Hint: $$\begin{align}(p-1)! &= (p-r-1)!\color{blue}{(p-r)(p-r+1)\cdots(p-1)}\\ &\equiv (p-r-1)!\color{blue}{(0-r)(0-r+1)\cdots(0-1)}\\ &=(p-r-1)!\color{blue}{(-r)(-(r-1))\cdots(-1)}\\ &=(p-r-1)!\color{blue}{(-1)^rr!}\pmod{p} \end{align}$$

AgentS
  • 12,195
  • I understand that $(p - r)(p -r + 1) \cdots (p - 1) \equiv r! \pmod p$ but I have a doubt, what happens if $r$ is an odd number? It would change the sign of $(-1)^rr!$ which I’m not sure affects the proof. – Octavio Berlanga Aug 05 '19 at 18:05
  • It equals $r!$ only when $r$ is even. When $r$ is odd it equals $-r!$. Maybe I'll add few more detailed steps in the answer.. $$(p - r)(p -r + 1) \cdots (p - 1) \equiv (-1)^r r! \pmod p$$ – AgentS Aug 05 '19 at 18:26
  • Notice that $(-1)^r $ equals $-1$ when $r$ is odd, so it is convenient to put $r$ in the exponent to fix the sign.. – AgentS Aug 05 '19 at 18:32
  • Alright, thank you so much. – Octavio Berlanga Aug 05 '19 at 18:36