In number theory, when $p \equiv 1\pmod{4}$we know that -1 is a residue. And by Wilson`s theorem , $(p-1)! \equiv 1 \pmod{p}.$ If we define r by $0<r<p/2, r^{2}\equiv -1 \pmod{p}$, then we have $\frac{p-1}{2}! \equiv \pm r \pmod{p}$
My question is when the sign takes +1? Is there any known result about the conditions for it to take +1?
I have checked Dickson`s history. Near the end of Chapter IX it mentions a French paper by E.Malo in 1906. However,the description of the result there seems trivial. And I can not find anywhere that paper.
A similar question is this, consider $\displaystyle t=\prod_{i=1 \atop \big(\frac{i}{p}\big)=1}^{(p-1)/2} i$ , it is easy to see that $t\equiv \pm1 \pmod{p}$ when $p\equiv 5 \pmod{8}$ ; whereas $t\equiv \pm (p-1)/2!\pmod{p}$ when $p\equiv1 \pmod{8}$. When the sign takes +1?
Any reply will be helpful.