Prime and divisibility Let $\displaystyle p$ be a prime number and $\displaystyle x\in \mathbb{Z}$ satisfy $\displaystyle p\mid x^{3} -1$
but $\displaystyle p\nmid x-1$. Prove that $\displaystyle p\mid( p-1) !\left( x-\frac{x^{2}}{2} +\frac{x^{3}}{3} -...-\frac{x^{p-1}}{p-1}\right)$
p/s:
I have proved that $\displaystyle \left\{x,x^{2} ,..,x^{p-1}\right\}$ is a reduced residue system modulo $\displaystyle p$, but i still can't solve the problem
I got stuck at this point, or may be something was wrong
\begin{array}{l}
( p-1) !\left( x-\frac{x^{2}}{2} +\frac{x^{3}}{3} -...-\frac{x^{p-1}}{p-1}\right)\\
=( p-1) !\left(\frac{x( p-1) !}{( p-1) !} -\frac{\frac{x^{2}}{2}( p-1) !}{( p-1) !} +...-\frac{x^{p-1}( p-2) !}{( p-1) !}\right)\\
=x( p-1) !^{2} -x^{2}( p-1) !\frac{1}{2} -...-x^{p-1}( p-2) !\\
=x\left(\prod _{i}^{p-1} x_{i}\right)( p-1) !-\frac{x^{2}}{2}( p-1) !\left(\prod _{i}^{p-1} x_{i}\right) +...-\frac{x^{p-1}}{p-1}( p-1) !\left(\prod _{i}^{p-1} x_{i}\right)
\end{array}
 A: I'm going to reduce this to another form which I think is easier. We have that
$$(x-1)(x^2+x+1)\equiv 0\mod p$$
$$x^2+x+1\equiv 4x^2+4x+4=(2x+1)^2+3\equiv 0$$
$$(2x+1)^2\equiv -3.$$
So $\left(\frac{-3}p\right)=1$, then $\left(\frac{-1}p\right)\left(\frac{3}p\right)=1$ and by quadratic reciprocity $\left(\frac{p}3\right)\left(\frac{3}p\right)=(-1)^{(p-1)/2}$ so $\left(\frac{p}3\right)=1$ so $p\equiv 1 \mod 3$. This means that the three sums below have the same number of terms, I don't know if that helps. We want to prove that
$$\sum_{h=1}^{p-1}(-1)^{h+1}x^h h^{-1}\equiv 0$$
but $x^3\equiv 1$ so we can get rid of the exponents greater than 2. So that's equivalent to
$$S_1+S_2x+S_3x^2\equiv 0$$
where
$$S_1=\sum_{h\equiv 0\mod 3} (-1)^{h+1}h^{-1}$$
$$S_2=\sum_{h\equiv 1} (-1)^{h+1}h^{-1}$$
$$S_3=\sum_{h\equiv 2} (-1)^{h+1}h^{-1}.$$
You can also use that $x^2\equiv -1-x$ to get another equivalent form $S_1-S_3+(S_2-S_3)x\equiv 0$.
A: Let
$$S=\sum\limits_{k=1}^{p-1}\frac{(-1)^k}{k}$$
$(p-1)! \not \equiv 0 \pmod p$, therefore we must just prove $S\equiv 0 \pmod p$.
$x^3\equiv 1 \pmod p\Rightarrow 3|p-1 \Leftrightarrow p\equiv 1\pmod 3$.
Let
$$S_r=\sum\limits_{k=1, \ k\equiv r\pmod 3}^{p-1}\frac{(-1)^k}{k}$$
Therefore $S\equiv S_0+xS_1+x^2S_2 \pmod p$. And $1+x+x^2\equiv 0\pmod p$ then
$S\equiv x(S_1-S_0)+x^2(S_2-S_0) \pmod p$
For $1\leqslant k\leqslant p-1$ map $k\to p-k$ is bijectively. Therefore
$$S_1=\sum\limits_{k=1, \ p-k\equiv 1\pmod 3}^{p-1}\frac{(-1)^{p-k}}{p-k}\equiv (-1)^{p-1}\sum\limits_{k=1, \ k\equiv 0\pmod 3}^{p-1}\frac{(-1)^k}{k}\equiv S_0\pmod p$$
Consider $$B=\sum\limits_{m=1}^{p-1}\frac{(-1)^{3m}}{3m}$$
One side $$B\equiv\frac{1}{3}\sum\limits_{m=1}^{p-1}\frac{(-1)^m}{m}\equiv\frac{1}{3}(S_0+S_1+S_2) \pmod p$$
On other side $$B=\left(\sum\limits_{0<3m<p}+\sum\limits_{p<3m<2p}+\sum\limits_{2p<3m<3p}\right)\frac{(-1)^{3m}}{3m}\equiv$$
$$=\sum\limits_{k=1}^{p-1}\frac{(-1)^k}{k}+(-1)^p\sum\limits_{p<3m<2p}\frac{(-1)^{3m-p}}{3m-p}+\sum\limits_{2p<3m<3p}\frac{(-1)^{3m-2p}}{3m-2p}\equiv S_0-S_2+S_1 \pmod p$$
here $k=3m-p\equiv 2\pmod 3$ and $k=3m-2p\equiv 1\pmod 3$
Thus $\frac{1}{3}(S_0+S_1+S_2)\equiv S_0-S_2+S_1 \pmod p$ and $S_0\equiv S_1 \pmod p$. Therefore $\frac{2}{3}S_0+\frac{1}{3}S_2\equiv 2S_0-S_2 \Leftrightarrow S_2\equiv S_0 \pmod p$.
Therefore $S\equiv 0 + 0x\equiv 0\pmod p$
QED
P.S. It may by generalized for all prime moduli $P$, not only for $P=3$.
