How to evaluate $\prod_{n=1}^{p-1} \sin(\frac{2n^2\pi}{p})$ According to Quadratic Gauss sum
I want to know what is the exact value of this product?,since I put this product on Wolfram Alpha and I got the result in this form $$\frac{a+b\sqrt{
p}}{c}$$ for some positive integers $a,b,c$
But I dont know How a,b,c are related to each other.
 A: I suppose $p$ is an odd prime. Let the product be $S_p$ (it is positive). Using
$$\ln\left|2\sin\frac{x}{2}\right|=-\sum_{m=1}^{\infty}\frac{\cos mx}{m}\qquad(x\notin2\pi\mathbb{Z}),$$
we see that
$$\ln(2^{p-1}S_p)=-\sum_{m=1}^{\infty}\frac{l_p(m)}{m},\qquad l_p(m)=\sum_{n=1}^{p-1}\cos\frac{4mn^2\pi}{p}.$$
The article allows to find $l_p(m)=a_p(m)+b_p(m)$, where
$$a_p(m)=\begin{cases}p-1,&p\mid m\\\hfill-1,&p\nmid m\end{cases},\qquad b_p(m)=\begin{cases}\Big(\dfrac{2m}{p}\Big)\sqrt{p},&p=4k+1\\\hfill0,&p=4k+3\end{cases}.$$
Now we have
\begin{align}\sum_{m=1}^{\infty}\frac{a_p(m)}{m}&=\sum_{q=0}^{\infty}\left(\frac{1}{q+1}-\sum_{r=1}^{p}\frac{1}{pq+r}\right)\\&=\sum_{q=0}^{\infty}\int_0^1 x^{pq}\left(px^{p-1}-\frac{1-x^p}{1-x}\right)dx\\&=\int_0^1\left(\frac{px^{p-1}}{1-x^p}-\frac{1}{1-x}\right)dx=-\ln p,\end{align}
which settles $p=4k+3$, giving $S_p=p/2^{p-1}$.
The case $p=4k+1$ is harder. The so-called class number formula tells
$$\sum_{m=1}^{\infty}\frac{b_p(m)}{m}=\Big(\frac{2}{p}\Big)\sqrt{p}\ L(1,\chi_p)=2\Big(\frac{2}{p}\Big)h(p)\ln\epsilon_p,$$
where $L(1,\chi_p)$ is the Dirichlet $L$-function for $\chi_p(m)=\Big(\dfrac{m}{p}\Big)=\Big(\dfrac{p}{m}\Big)$ (in our case), $h(p)$ is the class number of $\mathbb{Q}(\sqrt{p})$ (fixme...), and $\epsilon_p$ is the fundamental unit of $\mathbb{Q}(\sqrt{p})$. Finally,
$$S_p=\begin{cases}\dfrac{p}{2^{p-1}}\epsilon_p^{-2h(p)(\frac{2}{p})},&p=4k+1\\ \hfill\dfrac{p}{2^{p-1}},&p=4k+3\end{cases}.$$
