# Counting function for sums of three squares

Legendre showed that an integer is the sum of three squares if and only if it is not of the form $4^n(8m + 7)$ for some nonnegative integers $n$ and $m$. However, I have been unable to find any information regarding the counting function.

Let $S(x)$ denote the number of positive integers $\leq x$ which are the sum of three squares. What is known regarding $L: =\displaystyle \lim_{x \to \infty} \frac{S(x)}{x}$? The above characterization of Legendre easily shows that $L \leq \frac{7}{8}$, but can we do better? Is an exact value of $L$ known to exist?

## migrated from mathoverflow.netMar 9 '14 at 1:41

This question came from our site for professional mathematicians.

• Just sum the geometric progression: 1/8 are of this form with n=0; 1/32 are of this form with n=1; 1/128 are of this form with n=2 etc. these are disjoint subsequences. – anthonyquas Mar 8 '14 at 18:32
• As Anthony Quas says, summing the progressions gives a density of $5/6$. The more interesting'' questions concern the error term $S(x)-5x/6$; see, e.g., blms.oxfordjournals.org/content/20/3/203.abstract – so-called friend Don Mar 8 '14 at 18:32
• @AnthonyQuas That was a silly oversight on my part. Thanks for the reference and helpful comments. – David Mar 8 '14 at 18:39

## 1 Answer

Answer from comments: The quantity $\displaystyle \lim_{x \to \infty}S(x)/x$ is trivially given by: $$1 - \frac{1}{8} \sum_{n=0}^{\infty} \frac{1}{4^n} = \frac{5}{6}.$$ Furthermore, P. Shiu has shown that $S(x) - \frac{5}{6} x = O( \log x)$.