Skip to main content
2 of 3
added 165 characters in body
Richard Stanley
  • 50.8k
  • 14
  • 155
  • 279

According to Theorem 5.1 of http://math.mit.edu/~rstan/pubs/pubfiles/35.pdf, the number is $$ \frac 1p\left[ 2^{p-1}+\frac{p-1}{2}(\epsilon^{4h} + \epsilon^{-4h})\right], $$ where $h$ is the class number of $\mathbb{Q}(\sqrt{p})$ and $\epsilon>1$ the fundamental unit of $\mathbb{Q}(\sqrt{p})$.

Richard Stanley
  • 50.8k
  • 14
  • 155
  • 279