1/2 Wilson's theorem

For the case $p\equiv 1\pmod{4}$, see the following paper of Chowla: On the class number of real quadratic fields. Proc. Nat. Acad. Sci. U.S.A. 47 (1961), 878. There the following is proved:

Let $h$ be the class number of $\mathbb{Q}(\sqrt{p})$, and let $\epsilon = (u+v\sqrt{p})/2$ be the fundamental unit of the corresponding ring of integers. Then $h$ is odd and $$ 2\cdot \frac{p-1}{2}! \equiv (-1)^{(h+1)/2} u \pmod{p}.$$

One can find an exposition of this result (and related material) in the last chapter of Pollack's Conversational Introduction to Algebraic Number Theory.


See the paper by Mordell: The congruence (p−1/2)!≡±1 (mod p). Amer. Math. Monthly 68 1961 145–146.