# Permutations $\pi\in S_{p-1}$ with $\frac1{\pi(1)\pi(2)}+\frac1{\pi(2)\pi(3)}+\cdots+\frac1{\pi(p-2)\pi(p-1)}+\frac1{\pi(p-1)\pi(1)}\equiv0\pmod{p^2}$

A well known congruence of Wolstenholme states that $$\frac1{1^2}+\frac1{2^2}+\cdots+\frac1{(p-1)^2}\equiv0\pmod{p}$$ for any prime $$p>3$$. For each $$n=3,4,\ldots$$ we clearly have $$\frac1{1\times2}+\frac1{2\times3}+\cdots+\frac1{(n-1)n}+\frac1{n\times1} = 1.$$

Motivated by the above, here I ask a new question.

Question. Is it true that for each prime $$p>3$$ there is a permutation $$\pi\in S_{p-1}$$ with $$\pi(p-1)=p-1$$ and $$\pi(p-2)=p-2$$ such that the congruence $$\frac1{\pi(1)\pi(2)}+\frac1{\pi(2)\pi(3)}+\cdots+\frac1{\pi(p-2)\pi(p-1)}+\frac1{\pi(p-1)\pi(1)}\equiv0\pmod{p^2}$$ holds?

For $$p=5$$, there is a unique permutation $$\pi\in S_4$$ meeting the requirement, namely, $$\frac 1{2\times1}+\frac1{1\times3}+\frac1{3\times4}+\frac1{4\times2}=\frac{25}{24}\equiv0\pmod{5^2}.$$ For $$p=7$$, there is also a unique permutation $$\pi\in S_6$$ meeting the requirement, namely, $$\frac1{2\times3}+\frac1{3\times4}+\frac1{4\times1}+\frac1{1\times5}+\frac1{5\times6}+\frac1{6\times2}=\frac{49}{60}\equiv0\pmod{7^2}.$$ For $$p=11$$ there are totally $$323$$ permutations $$\pi\in S_{10}$$ meeting the requirement. For $$p=13$$, the permutation $$(\pi(1),\ldots,\pi(12))=(1,2,3,7,4,9,5,8,10,6,11,12)$$ meets our purpose. Based on these data, I conjecture that the question has a positive answer.

• Did you check the repartition of the numbers $\sum_{i=1}^{p-1}1/(\pi(i)\pi(i+1))$ (with cyclic conditions) into different classes modulo $p^2$? Since $p^2$ is much smaller than $p!$ for $p$ large, there should be only a finite number of counterexamples except if the repartition of the above numbers into classes modulo $p^2$ is very unequal (which would pe surprising and interesting in itself). Jul 15 at 7:40

Let $$(\pi(1),\pi(2),\ldots,\pi(p-1))=(2,3,\ldots,p-3,1,p-2,p-1).$$ Then \begin{align*} \frac1{\pi(1)\pi(2)}+\frac1{\pi(2)\pi(3)}+\cdots+\frac1{\pi(p-2)\pi(p-1)}+\frac1{\pi(p-1)\pi(1)}=&\frac{p^2}{2(p-1)(p-2)}\\ \equiv&0\pmod{p^2}. \end{align*}

• So, I guess this means that this the OPs conjecture is not only true for each prime $>3$ but each odd number $>3$.. Jul 16 at 15:39
• Of course！If we replace $p$ by any odd integer $n>3$ in the construction, then the sum equals n^2/(2(n-1)(n-2)). Jul 16 at 15:44

Not a proof, but some numerical evidence and an alternative conjecture:

It is straightforward to search permutations that do the trick for each $$p$$. When doing that for all $$5\leq p\leq101$$ I have found permissible permutations for all $$p$$ except $$\\{6, 8, 30, 60, 70, 78, 88, 90\\}$$, all of which are non-prime. I dumped the solutions here. I hope the format is clear; the first few lines are:

5 25/24 = 5^2*1/24 [2, 1, 3, 4]
6 None
7 49/60 = 7^2*1/60 [2, 3, 4, 1, 5, 6]
8 None
9 81/112 = 9^2*1/112 [2, 3, 4, 5, 6, 1, 7, 8]
10 200/189 = 10^2*2/189 [6, 3, 2, 1, 5, 4, 7, 8, 9]
11 121/180 = 11^2*1/180 [2, 3, 4, 5, 6, 7, 8, 1, 9, 10]
12 288/385 = 12^2*2/385 [6, 1, 5, 2, 7, 4, 3, 8, 9, 10, 11]
13 169/264 = 13^2*1/264 [2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 11, 12]
14 20776/19305 = 14^2*106/19305 [11, 10, 8, 6, 1, 2, 3, 4, 5, 7, 9, 12, 13]


For $$p=6$$ and $$p=8$$, I searched all permutations exhaustively, so I'm sure that none exists. For $$p\in\\{30, 60, 70, 78, 88, 90\\}$$, it might just be that I didn't search long enough.

• Please note that in the original question, the author required that $\pi(p-2)=p-2$ and $\pi(p-1)=p-1$. However, some of your examples do not meet the requirement. Jul 16 at 13:55
• thanks for the heads up, I will make sure to add that requirement... Jul 16 at 14:18
• Based on your numerical evidence, I find a constructive solution of original question. Jul 16 at 15:29
• @C.WANG nice work! Jul 16 at 15:30