Sums of two squares: What is known about the distribution of r(n)? The distribution of sums of two squares has been studied by Landau. What is known about the distribution of the function $r(n)$, the number of representations of $n$ as the sum of two squares? Some specific questions of interest to us are these. Suppose $a \leq n\leq b$. What is the average value of $r(n)$? What is the standard deviation?  
Edit: Thanks for the answer and comments. I am particularly interested in the range $a\leq n\leq b$ where $b-a = \Theta(\sqrt{a})$.  Let $a,b$ be like that, and let $C(n)$ be the circle of radius $n$ around a fixed center.
Conjecture. The number of integers $n\in[a,b]$ with $r(n)>0$ is $\Omega(\sqrt{a})$. Furthermore, if $S$ is the segment of $C(b)$ cut off by a chord of length $\Omega(\sqrt{a})$ that touches $C(a)$ and if $r_S(n)$ is the number of lattice points in $C(n)\cap S$ then the number of integers $n\in[a,b]$ with $r_S(n)>0$ is $\Omega(\sqrt{a})$.
Added: Finally, with the help of Greg Martin, I got hold of relevant literature and educated myself. Thank you again for the useful answers and comments!
 A: I don't believe your new conjecture is true. Taking $b=a+\sqrt a$ for concreteness: standard sieve results show that the number of integers in $[a,b]$ that can be represented as the sum of two squares is $O(\sqrt{a/\log a})$. (This is closely related to the fact that the counting function of the sums of two squares is asymptotic to a constant times $x/\sqrt{\log x}$.)
A: The topic is too general, and your question is too vague. 
At any rate, for a large $x$, the average value of $r(n)$ for $1\leq n\leq x$ is about $\pi$, while the standard deviation is about $2\sqrt{\log x}$. There are many ways to prove this, perhaps the most instructive is to look at the Dirichlet series $\sum r(n)n^{-s}$ and $\sum r(n)^2n^{-s}$ which have poles of order $1$ and $2$, respectively (as follows from their Euler product decomposition). The following recent paper discusses the analogous problem in short intervals: Garaev-Kühleitner-Luca-Nowak, Asymptotic formulas for certain arithmetic functions, Math. Slovaca 58 (2008), 301–308.
Added. One can turn Greg Martin's response into a rigorous disproof of the added conjecture as follows. Assume that the conjecture is true, then in any interval $(a+k\sqrt{a},a+(k+1)\sqrt{a})$ with $0\leq k\leq\sqrt{a}$ the number of $n$'s with $r(n)>0$ is $\Omega(\sqrt{a})$. This implies that in $(a,2a)$ the number of $n$'s with $r(n)>0$ is $\Omega(a)$, contradicting Landau's result $O(a/\sqrt{\log a})$ for the number of such $n$'s.
