I was intrigued by this result in Journal of Number Theory from 2013. Let $ n = 2^{\lambda_2}\prod p^{\lambda_p}$ .

TheoremThe number of $ (x,y,z) \in \mathbb{Z}^3$ such that $ n^ 2 = x^2 + y^2 + 2z^2$ is given by $ $ b(\lambda_2) \prod_p \left[ \frac{p^{\lambda_p+1}-1}{p-1} – \left( \frac{-2}{p}\right)\frac{p^{\lambda_p}-1}{p-1} \right]$ $ and the values of the Legendre symbol are given by $ $ b(\lambda_2) = \left\{ \begin{array}{cl} 1 & \lambda_2 = 0 \ & \lambda_2 \geq 1\end{array} \right.$ $ and the values of the Legendre symbol are given by $ $ \left( \frac{-2}{p}\right) = \left\{ \begin{array}{cl} 1 &p \equiv 1,3 \pmod 8 \ -1&p \equiv 5,7 \pmod 8 \end{array} \right.$ $

I think this problem is slightly difficult because you have to sieve out the squares, but otherwise, shouldn’t this result fall out of Hasse principle or a theta function of some kind? I could solve this equation possibly over each prime (as well as $ p=2$ ) and then multiply the result.

$ $ p^2 = x^2 + y^2 + 2z^2 $ $

There’s no guarantee even of one solution here, but for this enumerative result we’re simply stating that we could multiply the result from all places.

Was it new to count solutions over all primes? Does the number of solutions $ r_{(1,1,2)}(p^2)$ for all primes not sufficient to determine $ r_{(1,1,2)}$ in general? I remember reading that the class number was either 1 or 2 (but I don’t even know what that means).