# Congruence for the product of quadratic residues + the product of quadratic non-residues

My question has been here on MSE for a long time, but it has not received a full answer. I bring it here:

Find a prime $$p$$ such that $$p \equiv 1 \bmod 4$$ and such that the product in the range $$[1,p-1]$$ of the quadratic residues + the product in the range $$[1,p-1]$$ of the quadratic non-residues is divisible by $$p^2$$, or show that such a prime does not exist.

Nota: I know that for any prime $$p$$ such that $$p \equiv 3 \bmod 4$$, the product of the quadratic residues + the product of the quadratic non-residues is always divisible by $$p^2$$. I have check that this is not the case for all primes $$p$$ smaller than $$400000$$ and such that $$p \equiv 1 \bmod 4$$.

• You should clarify that the quadratic residues and non-residues are taken in the range $[1,p-1]$. – Lucia Oct 20 '18 at 19:00
• ok, thank you. I have clarified the question. – René Gy Oct 20 '18 at 20:57
• The sum $S$ of these two products is divisible by $p$. Assuming $S/p$ is random mod $p$ as you indicate in the MSE post, then this problem is similar to that of Wilson primes, and we should expect that the number of primes $p \leq x$, $p \equiv 1 \textrm{ mod }4$ such that $S\equiv 0 \textrm{ mod }p^2$ is asymptotic to $\frac12 \log \log x$. For $x=4 \cdot 10^5$ the expected number of such primes is $\approx 0.992$ so it could be a good idea to look further. – François Brunault Oct 22 '18 at 20:06
• Using advanced algorithms, Wilson primes have been searched up to $2 \cdot 10^{13}$, see arxiv.org/abs/1209.3436 (A search for Wilson primes, Mathematics of Computation 83 (2014), 3071-3091) – François Brunault Oct 22 '18 at 20:14