Application of Wilson's theorem: How do I show that $(p-1)! \equiv (p-1)\mod (1 + 2 + \ldots p-1)?$

825 Views Asked by At

How do I show that

$$(p-1)! \equiv (p-1)\bmod (1 + 2 + \ldots p-1)$$

I have no idea how to solve this problem. I tried to write the sum formula from $1$ to $p-1$ but this didn't give me anything.

If someone can help me I would appreciate it.

2

There are 2 best solutions below

0
On BEST ANSWER

It's trivial when $p=2$. Let $p>2$ (i.e. $p$ is odd).

$1+2+\cdots+(p-1)=\frac{(p-1)p}{2}$ (proof here).

$\gcd\left(\frac{p-1}{2},p\right)=1$, so

$$(p-1)!\equiv p-1\pmod{p\cdot \frac{p-1}{2}}\iff\begin{cases}(p-1)!\equiv p-1\pmod{p}\\(p-1)!\equiv p-1\pmod{\frac{p-1}{2}}\end{cases}$$

First one follows from Wilson's theorem, second one follows from both sides being divisible by $\frac{p-1}{2}$ (congruent to $0$).

1
On

Firstly, $1 + 2 + \cdots + (p-1) = (p)\left(\frac{p-1}{2}\right)$. These two factors are relatively prime. So to understand the congruence, we can use the Chinese Remainder Theorem and find the solution to the system $$\begin{align} x \equiv (p-1)! &\mod p \\ x \equiv (p-1)! &\mod{(p-1)/2}. \end{align}$$

The first line is $(p-1)$ by Wilson's Theorem. The second is $0$. So $x$ is the unique multiple of $(p-1)/2$ which is also congruent to $(p-1)$ mod $p$. Of course, this is $(p-1)$.

Thus $(p-1)! \equiv (p-1) \pmod {1 + 2 + \cdots + (p-1)}$. $\diamondsuit$