**Definitions:**


Lagrange's theorem implies that for each prime $p$, the factors of $(p − 1)!$ can be arranged in unequal pairs, with the exception of $±1$, where the product of each pair $≡ 1 \pmod p$. *[See Wiki article on Wilson's theorem.](https://en.wikipedia.org/wiki/Wilson's_theorem#Prime_modulus)*


From the example in the link above, for $p=11$ we have


$$(11-1)!=[(1\cdot10)]\cdot[(2\cdot6)(3\cdot4)(5\cdot9)(7\cdot8)] \equiv [-1]\cdot[1\cdot1\cdot1\cdot1] \equiv -1 \pmod{11}$$


Let the products of the pairs that $≡ 1 \pmod p$ be the multiset $A\_p$, and $A\_{p\_n}$ the multiset for the $n$th prime.


For the above example then, $A\_{p\_5}=\{(2\cdot6),(3\cdot4),(5\cdot9),(7\cdot8)\}=\{12,12,45,56\}$.


**Conjecture:**


$$\lim\limits\_{n\rightarrow\infty}\dfrac{\sum\limits\_{k \in A\_{p\_n}}(k-1)}{(p\_n)^3}\approx\frac18$$


where $p\_n$ is the $n$th prime.


**Examples:**


For $p=11$ we have


$$\dfrac{11+11+44+55}{11^3}=\dfrac{1}{11}$$


For $p=997$ we have


$$\dfrac{123218233}{997^3}=\dfrac{123218233}{991026973}$$


**Comments:**


As @YCor noted below, the $-1$ in the $k-1$ can be removed, since its contribution tends to $0$. The conjecture can therefore be simplified to


$$\lim\limits\_{n\rightarrow\infty}\dfrac{\sum\limits\_{k \in A\_{p\_n}}k}{(p\_n)^3}\approx\frac18$$


I have no idea whether the above statement is correct, or how to go about trying to find a proof. Any comments on the any of the above are most welcome.



A conjecture based on Wilson's theorem
For an integer $n$ with $1\leq n\leq p-1$, let $n^{-1}$ be the inverse of $n$ modulo $p$. It follows from Weil's bound on Kloosterman sums that for every $\epsilon>0$ the set $\{n: xp\leq n\leq (x+\epsilon) p, yp\leq n^{-1}<(y+\epsilon) p\}$ has cardinality $\epsilon^2p+\mathcal{O}(\sqrt{p}\log^2 p)$. Hence up to a relative error tending to 0 the sum in question can be replaced by an integral, that is
$$
\sum\_{n=1}^{p-1} n\cdot n^{-1} \sim p^3\int\_0^1\int\_0^1 xy\;dx\;dy = \frac{p^3}{4}.
$$
(Note that the $\cdot$ on the left hand side refers to the multiplication of integers, not to modular multiplication). Here each pair $(a,b)$ with $ab\equiv 1\pmod{p}$ is counted twice, with the exception of $(1,1)$ and $(-1, -1)$, which contribute less than $p^2$. Hence up to an error $\mathcal{O}(p^2)$ the left hand side of the above expression is twice $\sum\_{k\in A} k$, which proves your claim.


