Quadratic Forms and Congruences How does one prove (the non-trivial direction) that, for $n \in \mathbb{N}$,
$x^2 + y^2 + z^2 = n$ solvable $\iff$ $x^2 + y^2 + z^2 \equiv n\ (m)$ solvable for all $m$?
In particular, is there a weaker assumption (less congruences on the right)?
I am also interested in generalisations. Please, include references.
Thanks!
 A: Let's see, Gerry is correct, of course, about the Hasse principle. I cannot tell your background, so: The list of the 102 diagonal forms $a x^2 + b y^2 + c z^2$ that do the same thing, with $1 \leq a \leq b \leq c, \gcd(a,b,c) = 1,$ is in the document I called Dickson_Diagonal_1939 at TERNARY. Complete proofs for some of the 102 (including yours) are in that book, Modern Elementary Theory of Numbers, by Leonard Eugene Dickson.  The full list of 913 forms $ a x^2 + b y^2 + c z^2 + r y z + s z x + t x y,  $ or $\langle a,b,c,r,s,t \rangle$   is at the same site in my paper with Kaplansky labelled Kap_Jagy_Schiemann_1997. At the time, 22 out of 913 forms lacked proof. Byeong-Kweon Oh (item 26, Acta Arithmetica) proved 8 more. The latest thing is that Ken Ono's student R. Lemke Oliver (item number 9, Bulletin London M. Soc., turns out his correct last name is Lemke Oliver, no hyphen)  has shown that GRH implies the final 14 are regular.
Let's see, there are infinitely many indefinite forms that do this. Indeed, it took quite a bit of effort to show that there were any indefinite ternary forms that were not regular.
Back to positive ternaries, Wai Kiu Chan and Oh have made an industry of forms that have finitely many exceptions. For ternary forms, we must distinguish weak and strong exceptions: the form $x^2 + 4 y^2 + 9 z^2$ represents all eligible numbers except 2, Kap called that a weak exception. The form $2x^2 + 3 y^2 + 5 z^2 + 2 y z + 2 z x$ misses 1 and, indeed, all $4^k,$ so Kap called this a strong exception. That is in my paper, Jagy_1996_Acta_Arithmetica at the same site.
Proofs. The proofs for the 913-14 = 899 are all over. Many are in the document Jagy_Encyclopedia, including those that Kap did not write down anywhere permanent.  It is automatic if a form is alone in its genus. The forms in a genus, taken together, represent all eligible numbers. Lists of genera are available at SCHIEMANN_1 and SCHIEMANN_2
EEEEDDDDIIITTTTTTTTT: since Erick Wong mentions the Aubry-Davenport-Cassels technique, I should draw some distinctions  between rational representation and integral representation. As Pete L. Clark (item 23, with me, Acta Arithmetica) calls it, the very strong ADC property, that a form represents a number integrally if and only it represents the number rationally, actually happens for only 103 forms. Your, milder, condition, is referred to as regularity. Here is a good one: $
x^2 + 2 y^2 + 10 z^2$ is regular, it is on Dickson's list, but it is not ADC.
A: $x^2 + y^2 + z^2 = n$ is solvable over the integers iff $n$ is not of the form $4^t (8k+7)$.
If $n = 4^t (8k+7)$, then $x^2 + y^2 + z^2 = n$ is not solvable mod $4^t \times 8$.
