Prove that $p$ divides $(p-1)!\sum_{k=1}^{p-1}(-1)^{k-1}x^k/k $ Let $p$ be an odd prime such that $p\mid x^3-1$ but $p\not\mid x-1$. Prove that $$p \mid (p-1)!\sum_{k=1}^{p-1}(-1)^{k-1}\frac{x^k}{k} $$
This is my work,
Lemma if $p$ is prime then $$k^{-1}\equiv (-1)^{k-1}{p \choose k}/p\pmod p$$
Now note that $$\sum_{k=1}^{p-1}(-1)^{k-1}\frac{x^k}{k}\equiv \sum_{k=1}^{p-1}x^k{p \choose k}/p\equiv\frac{1}{p}\sum_{k=1}^{p-1}x^k{p \choose k}\pmod p$$
And we know that $$(x+1)^p=\sum_{k=0}^{p}x^k{p \choose k}=1+x^p+\sum_{k=1}^{p-1}x^k{p \choose k}$$
Hence $$\sum_{k=1}^{p-1}x^k{p \choose k}\equiv 0\pmod p.$$
Also we know $(p-1)!\equiv -1\pmod p$, so $$(p-1)!\sum_{k=1}^{p-1}(-1)^{k-1}\frac{x^k}{k}\equiv -\frac{1}{p}\sum_{k=1}^{p-1}x^k{p \choose k}\pmod p$$
so we need to prove this last guy is divisible by $p$, or equivalently $$\sum_{k=1}^{p-1}x^k{p \choose k}\equiv 0\pmod{p^2}$$
 A: Note first that because of $p|(x^3-1)$ and $p\not | (x-1)$ we have $x^3=1$, $x\ne1$  and  and $x^2+x+1=0$ modulo $p$. Besides there are only two values $a,b\in \mathbb F_p$ satisfying the equation $x^2+x+1=0$ and we have $a+b=-1$ and $ab=1$.
Further the only involved primes are those of the form $3n+1$ because if $p=3n+2$ then (Fermat's little theorem) $x^{3n+1}=x(x^3)^n=x=1$ modulo $p$. Moreover the factor  $(p-1)!$ is only the factor $-1$ modulo $p$ (Wilson's theorem) therefore in
$$p \mid (p-1)!\sum_{k=1}^{p-1}(-1)^{k-1}\frac{x^k}{k}\iff(p-1)!\sum_{k=1}^{p-1}(-1)^{k-1}\frac{x^k}{k}\equiv0\pmod p$$ we can consider just $$\sum_{k=1}^{p-1}(-1)^{k-1}\frac{x^k}{k}\equiv0\pmod p$$ for the only values $a,b$ of $x$ and $p$ a prime of the form $3n+1$.
$$*****$$
So we want to prove for $x=a$ and $x=b=\dfrac1a$ and the primes $p$ with the form $p\equiv1\pmod3$ $$\sum_{k=1}^{p-1}(-1)^{k-1}\frac{x^k}{k}\equiv0\pmod p$$ We have
$$\sum_{k=1}^{p-1}(-1)^{k-1}\frac{a^k}{k}=\left(a-\frac{a^2}{2}+\frac{a^3}{3}\right)-a^3\left(\frac a4-\frac{a^2}{5}+\frac{a^3}{6}\right)+a^6\left(\frac a7-\frac{a^2}{8}+\frac{a^3}{9}\right)\cdots -a^{3(n-1)}\left(\frac {a}{p-3}-\frac{a^2}{p-2}+\frac{a^3}{p-1}\right)$$
$$\sum_{k=1}^{p-1}(-1)^{k-1}\frac{a^k}{k}=\left(\frac a1+\frac{a+1}{2}+\frac{1}{3}\right)-\left(\frac a4+\frac{a+1}{5}+\frac{1}{6}\right)+\left(\frac a7+\frac{a+1}{8}+\frac{1}{9}\right)\cdots -\left(\frac {a}{p-3}+\frac{a+1}{p-2}+\frac{1}{p-1}\right)$$
This gives for some $A,B,C,D$ in $\mathbb F_p$
$$\sum_{k=1}^{p-1}(-1)^{k-1}\frac{a^k}{k}=Aa+B$$ if $Aa+B=C\iff Aa+D=0$. But we also have  $$\dfrac Aa+D=0$$ therefore $$A\left(a-\frac 1a\right)=0$$ from which $A=0$ and $D=0$ modulo $p$. We are done.
A: Basically, you need now to prove that $(x+1)^p-x^p-1$ is divisible by $p^2$ (why?). Here is a sketch of the proof:

*

*Prove that $3\mid p-1$ (you have an element of order 3 in $\mathbb{F}_p^{\times}$).


*Prove that polynomial $(t+1)^n-t^n-1$ is divisible by $(t^2+t+1)^2$ when $6\mid n-1$ (just take the derivative and check that the complex roots of $x^2+x+1$ are also roots of the derivative). Thus, for $n\equiv 1\pmod 6$ we have the identity
$$
(t+1)^{n}-t^n-1=(t^2+t+1)^2q(t),
$$
where $q(t)$ is a polynomial with integer coefficients.


*Prove that $(x+1)^p-x^p-1$ is divisible by $p^2$.
