TITLE: Generalization of Euler four square formula?
QUESTION [5 upvotes]: It is well known that the number of distinct decompositions of a positive natural number N into sum of four squares of integers is equal to 8*sum(d : d|N and not(4|d))
In other words, this is the number of distinct integer solutions of the quadratic form
x^2+y^2+z^2+w^2=N
How do I count solutions for more general quadratic forms?
For my purposes it suffice to limit the question to diagonal forms
a*x^2+b*y^2+c*z^2+d*w^2=N
In fact if it helps to simplify the question. The specific instance of interest right now is
x^2+y^2+z^2+2*w^2=2^L , where L is an integer.
Thanks,
Alex--

REPLY [6 votes]: The representation numbers for your specific quaternary quadratic form are determined in Theorem 5.1 of this paper by Alaca^2, Lemire, and Williams:
http://people.math.carleton.ca/~williams/papers/pdf/330.pdf
In particular, that theorem confirms the conjecture Noam made in the comments. For related results, see also this paper
http://people.math.carleton.ca/~williams/papers/pdf/310.pdf
and the references therein.