# On sums of two squares

The original question was: In my recent article (see section 2.3 here) I claim that the number of solutions to $$x^2 + y^2 \leq k$$ with unknown $$(x, y)$$ being integers (positive or negative) is asymptotically $$\pi k$$ as $$k$$ tends to infinity. Is this correct, is my reasoning correct in my article?

Updated question: Since a simple answer was provided by Daniel Fisher (this is the Gauss circle problem), I have now two deeper questions. One for which I believe I have an answer based on heuristic (see below), and one for which a reference may exist. These questions are related to the number of solutions to $$x^2 + y^2 =n$$ as $$n$$ gets very large. That number is denoted as $$r(n)$$, see here.

• Question 1: What is the asymptotic rate of growth for successive records of $$r(n)$$, as a function of $$n$$?
• Question 2: What is the rate of growth (asymptotically, on average) for $$r(n)$$, as a function of $$n$$ and only for values of $$n$$ such that $$r(n) > 0$$?

I may have an answer for question 2, and I am wondering if it can be made rigorous. It is backed by empirical evidence. Here is my approach. For $$k$$ between $$n$$ and $$2n$$, we have about $$\frac{2cn}{\sqrt{\log 2n}} - \frac{cn}{\sqrt{\log n}} \sim \frac{cn}{\sqrt{\log n}}$$ integers such that $$r(k)>0$$, based on this well known result, where $$c=0.7642...$$ is the Landau-Ramanujan constant. Also based on my initial question (the Gauss circle problem) the total number of solutions across all $$k$$'s between $$n$$ and $$2n$$ is asymptotically $$2\pi n - \pi n = \pi n$$. These $$\pi n$$ solutions are distributed across $$cn/\sqrt{\log n}$$ integers satisfying $$r(k) > 0$$. This means that for large $$n$$'s satisfying $$r(n)>0$$, the average value of $$r(n)$$ grows as $$\pi \sqrt{\log n}/c$$.

A consequence of this is that the records for $$r(n)$$ grow faster than $$\pi \sqrt{\log n}/c$$. How much faster? By a constant? That, I don't know.

Note: Sums of squares are far more abundant than primes, yet their natural density is also zero. This means that as $$n$$ becomes larger and larger, the chance for $$n$$ to be a sum of two squares, tends to zero. But for the few remaining $$n$$'s that can be expressed as a sum of two squares, the number of ways they can be expressed that way, increases more and more on average. That is, $$r(n)$$ tends to increase with $$n$$, for those few large $$n$$ satisfying $$r(n) > 0$$. As a result, for any $$n$$ large or small, the number of solutions to $$x^2 + y^2 = n$$ is equal to $$\pi$$ on average. What changes (it increases) when $$n$$ is large is the probability that $$r(n) = 0$$, but the average value of $$r(n)$$ remains unchanged.

• en.wikipedia.org/wiki/Gauss_circle_problem Jun 5, 2020 at 20:18
• @DanielFischer: Thank you for you answer! I updated my question, I believe it is now much more interesting. Jun 6, 2020 at 13:49
• Mathworld gives a formula for $r(n)$ based on the prime factorization of $n$. The records of $r(n)$ will come when $n$ has the correct type of factorization. It is related to, but different from, highly composite numbers because primes of the form $4k+3$ are penalized by having to come with even exponents. Jun 6, 2020 at 13:55