4

My question is simple: When $p=4k+3$, is there any order or pattern to when the residue of $\left(\frac{p-1}{2}\right)! \bmod p$ is $-1$ and when it is $1$?


In contemplating The amount of $n$ so that $n!+1$ is divisible by $p$ I confronted the above question, which I was unable to resolve in my own thinking.

For odd $p$, $(p-1)!$ has an even number of multiplicands which can be paired as follows: $1,p-1;\ 2,p-2;\ \dots \frac{p-1}{2},p-\frac{p-1}{2}$. Modulo $p$ these pairings are $1,-1;\ 2,-2;\ \dots$ etc. If we multiply the first member of each pair, and then the second member of each pair we see that $$\prod_{i=1}^{\frac{p-1}{2}}i\equiv (-1)^{\frac{p-1}{2}}\prod_{i=p-\frac{p-1}{2}}^{p-1}|i|\ \bmod p$$ Since the magnitudes of the multiplicands in each product are equal, the magnitudes of the products are equal, and the products differ if at all only by sign. Moreover, from Wilson's theorem, we know that the product of every multiplicand $(p-1)!\equiv -1 \bmod p$

When $p$ has the form $4k+1$, $(-1)^{\frac{p-1}{2}}=1$. So the two products are equal, and their product is congruent to $-1 \bmod p$.

When $p$ has the form $4k+3$, $(-1)^{\frac{p-1}{2}}=-1$. In that case, the products have equal magnitudes and opposite signs, and their product is congruent to $-1 \bmod p$. If we call that magnitude $a$, we have $-a^2\equiv -1 \bmod p\ \Rightarrow a^2\equiv 1 \bmod p$. This requires $a\equiv \pm1 \bmod p$

The upshot of this is that for $p=4k+3$, $$\left(\frac{p-1}{2}\right)! \equiv \pm1 \bmod p$$ I found this question proving that point, but not answering the question I pose below.

Looking at the first several examples of such $p$, I find that the residue is $-1$ for $\{7,11,19,\dots\}$ and the residue is $1$ for $\{23,31,\dots\}$.

Thomas Andrews
  • 177,126

0 Answers0