TITLE: Gauss - Dirichlet class number formula
QUESTION [8 upvotes]: Let $p=8k+3$ be a prime. Then the class number of the imaginary quadratic field $\mathbb Q(\sqrt{-p})$ is given by
$$h(-p)=\frac 13\sum_{k=1}^{\frac{p-1}{2}}\left(\frac kp \right).$$ While this is certainly a very elegant and compact formula, does it have any nontrivial applications or consequences? (Note that I am not asking about the Dirichlet class number formula relating the value of the corresponding $L$-series at $1$ with the class number, but rather about its particular corollary).

REPLY [20 votes]: Let $p=2n+1$ be a prime with $p\equiv3\pmod4$. By Wilson's theorem, $ (n!)^2\equiv1\pmod p$ and hence $n!\equiv\pm1\pmod p$. L. J. Mordell [Amer. Math. Monthly 68(1961), 145-146] used Dirichlet's class number formula  $$\left(2-\left(\frac 2p\right)\right) h(-p)=\sum_{k=1}^n\left(\frac kp\right)$$ to deduce in few lines that $n!\equiv(-1)^{(h(-p)+1)/2}\pmod p$ if $p>3$. This is a nice application of Dirichlet's class number formula.