# Prove $4\sum_{k=1}^{p-1}\frac{(-1)^k}{k^2}\equiv 3\sum_{k=1}^{p-1}\frac{1}{k^2}\pmod{p^2}$

Wolstenholme's theorem is stated as follows: if $p>3$ is a prime, then \begin{align*} \sum_{k=1}^{p-1}\frac{1}{k}\equiv 0 \pmod{p^2},\\ \sum_{k=1}^{p-1}\frac{1}{k^2} \equiv 0 \pmod{p}. \end{align*} It is also not hard to prove that $$\sum_{k=1}^{p-1}\frac{(-1)^k}{k^2}\equiv 0 \pmod{p}.$$ However, there are some relationships between $\sum_{k=1}^{p-1}\frac{(-1)^k}{k^2}$ and $\sum_{k=1}^{p-1}\frac{1}{k^2}$ mod $p^2$, which I can not prove.

Question: If $p$ is an odd prime, then $$4\sum_{k=1}^{p-1}\frac{(-1)^k}{k^2}\equiv 3\sum_{k=1}^{p-1}\frac{1}{k^2}\pmod{p^2}.$$ I have verified this congruence for $p$ upto $7919$.

(1) Since $$4\sum_{k=1}^{p-1}\frac{(-1)^k}{k^2}=2\sum_{k=1}^{\frac{p-1}{2}}\frac{1}{k^2}-4\sum_{k=1}^{p-1}\frac{1}{k^2},$$ we need to prove $$2\sum_{k=1}^{\frac{p-1}{2}}\frac{1}{k^2}\equiv 7\sum_{k=1}^{p-1}\frac{1}{k^2} \pmod{p^2}.$$ This idea was given by Fedor Petrov.

(2) It is interesting that the congruence in the question is ture mod $p^3$ for $p\ge 7$, i.e., $$4\sum_{k=1}^{p-1}\frac{(-1)^k}{k^2}\equiv 3\sum_{k=1}^{p-1}\frac{1}{k^2}\pmod{p^3}, \quad \text{for p\ge 7}.$$ This was conjectured by tkr.

I appreciate any proofs, hints, or references!

• I don't know if it is helpful, and maybe you noticed, but for primes $p > 5$ it seems (unless my code is wrong) that that your second congruence in the "comment" is true modulo $p^3$ (I checked all $p < 10000$, again unless my code wrong). – jfb Dec 23 '15 at 4:57
• @ tkr, I have checked your congruence mod $p^3$ for $p\ge 7$ and find it is true, which I didn't notice. Thanks! – Ji-Cai Liu Dec 23 '15 at 5:48
• Isn't it true that simply $S((p-1)/2)$ is divisible by $p^2$ for $p\geq 7$? It seems quite plausible, and this would reveal the magic about the coefficients 2 and 7 which are needed in this case only for $p=5$... – Ilya Bogdanov Dec 23 '15 at 10:49

This goes way back to Emma Lehmer, see her elementary paper on Fermat quotients and Bernoulli numbers from 1938.

Assume $p\ge 7$. First, I reformulate your congruence. I replace $$4\sum_{k=1}^{p-1}\frac{(-1)^k}{k^2}\equiv 3\sum_{k=1}^{p-1}\frac{1}{k^2}\pmod{p^3}$$ with the equivalent $$\sum_{k=1}^{p-1} \frac{1}{k^2} \equiv 8\sum_{k=1}^{\frac{p-1}{2}}\frac{1}{(p-2k)^2}\pmod{p^3}$$

Lehmer has proved the following, see equation (19) in the linked paper: $$\sum_{k=1}^{\frac{p-1}{2}} (p-2k)^{2r} \equiv p 2^{2r-1} B_{2r} \pmod {p^3}$$ (valid when $2r \not\equiv 2 \pmod {p-1}$). Plugging $2r=p^3-p^2-2$, we get

$$\sum_{k=1}^{\frac{p-1}{2}} (p-2k)^{p^3-p^2-2} \equiv p 2^{p^3-p^2-3} B_{p^3-p^2-2} \pmod {p^3}$$ Now use Euler's theorem to replace $x^{p^3-p^2-2}$ with $x^{-2}$:

$$\sum_{r=1}^{\frac{p-1}{2}} \left(\frac{1}{p-2k}\right)^2 \equiv p 2^{-3} B_{p^3-p^2-2} \pmod {p^3}$$

So your congruence becomes $$(*)\qquad \sum_{k=1}^{p-1} \frac{1}{k^2} \equiv pB_{p^3-p^2-2} \pmod {p^3}$$

This was also proved in Lehmer's paper - in equation (15) she writes $$\sum_{k=1}^{p-1} k^{2r} \equiv pB_{2r} \pmod {p^3}$$ (valid when $2r \neq 2 \mod {p-1}$). Plugging $2r=p^3-p^2-2$ and using Euler's theorem, we get the desired result.

It is now easy to generalize - when $2r \not\equiv 2 \pmod {p-1}$, we have $$\sum_{k=1}^{p-1} (-1)^k k^{2r} \equiv (1-2^{2r}) \sum_{k=1}^{p-1} k^{2r} \pmod {p^3}$$

Plugging $2r=p^3-p^2-2c$ ($c \not\equiv -1 \pmod {\frac{p-1}{2}}$) we get $$\sum_{k=1}^{p-1} \frac{(-1)^k}{k^{2c}} \equiv (1-2^{-2c}) \sum_{k=1}^{p-1} \frac{1}{k^{2c}} \pmod {p^3}$$

To get a taste of things, I include a proof of $(*)$. Via Faulhaber's formula for sum of powers, we get: $$\sum_{k=1}^{p-1} \frac{1}{k^2} \equiv \sum_{k=1}^{p-1} k^{p^3-p^2-2} \equiv \sum_{k=1}^{p} k^{p^3-p^2-2} =$$ $$\frac{1}{p^3-p^2-1} \sum_{j=0}^{p^3-p^2-2}\binom{p^3-p^2-1}{j}B_j p^{p^3-p^2-1-j} \pmod {p^3}$$ Note that odd-indexed Bernoulli's vanish, and that by the Von Staudt–Clausen theorem, the even-indexed Bernoulli's have $p$ in the denominator with multiplicity $\le 1$. Additionally, $B_{p^3-p^2-4}$ is $p$-integral (since $p-1 \nmid p^3-p^2-4$).

Hence, for the purpose of evaluating the sum modulo $p^3$, we can drop almost all the terms and remain only with the last one: $$\sum_{k=1}^{p-1} \frac{1}{k^2} = \frac{1}{p^3-p^2-1} \binom{p^3-p^2-1}{p^3-p^2-2} B_{p^3-p^2-2} p = pB_{p^3-p^2-2} \pmod {p^3}$$