MathOverflow is a question and answer site for professional mathematicians. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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!

share|cite|improve this question
The average value is $\pi$, as you can convince yourself by counting the integer points inside a large circle. For more information, see or (say) a book on analytic number theory ... – Abhinav Kumar Feb 8 '13 at 19:23
[Greg Martin is right; my comment from yesterday (deleted, but appended here) is correct but answers a different question.]$$ $$ "It's known that $\sum_{n<x} r(n) = \pi x + O(x^\theta)$ for some $\theta$ slightly less than $1/3$. (Getting $1/3$ is standard; the conjecture is that it's true for any $\theta > 1/4$.) That's more than enough to get $\sum_{n=a}^{a+\Theta(\sqrt{a})} r(n) > 0$ for large $a$." – Noam D. Elkies Feb 10 '13 at 16:20
Your conjecture is false, see the Added part of my response. – GH from MO Feb 10 '13 at 16:49

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.

share|cite|improve this answer
I'll add that these results are for the range $1\le n\le x$, as GH said. If your range $a\le n\le b$ is quite short, then our knowledge is extremely bad. For example, we can't yet prove that every range of the form $a\le n\le a+a^{1/5}$ (for $a$ sufficiently large) contains a sum of two squares at all! – Greg Martin Feb 9 '13 at 6:19

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}$.)

share|cite|improve this answer
One can turn your comment into a rigorous disproof, see the Added part of my response. – GH from MO Feb 10 '13 at 16:49

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.