# Sum of squares of sum of squares function $r_2(n)$

Let $r_2(n)$ denote the number of representations of $n$ as a sum of two squares.

What is known about the sum of squares of this function,

$\sum_{i=1}^n r_2(i)^2$

In particular is anything known about the asymptotics as $n \rightarrow \infty$?

• I believe that $r_k(i)$ is the number of ways to write $i$ as a sum of $k$ squares. (Cf. the SquaresR function in Mathematica.) – Aeolian Mar 6 '13 at 3:21
• Yep, I mistakenly put $r_k$ instead of $r_2$, fixed now =) – Loadge Mar 6 '13 at 6:43

Asymptotics are known for all integer moments of $r_2$: for any $m \ge 1$, there is an explicit constant $a_m$ such that $\sum_{n \le x} r_2(n)^m \sim a_m\cdot x\,(\log x)^{2^{m-1}-1}$. ($m=0$ also holds if we interpret $0^m$ as $0$.)

This result, including the precise constant (and a uniform generalization to other positive binary quadratic forms), can be found in V. Blomer and A. Granville, “Estimates for representation numbers of quadratic forms”, Duke Math. J. 135 (2006). Here's the PDF.

• Thanks Erick, I will check out the reference – Loadge Mar 6 '13 at 6:46

If you want to know exact formulae for these types of sums, I highly recommend "Number Theory in the Spirit of Ramanujan" by Bruce Berndt.

On page 56, a proof is given of $r_2(n) = 4 \sum_{d|n, d\ odd} (-1)^{(d-1)/2}$.

You can do a Dirichlet multiplication to get a double sum for $r_2^2(n)$.

By the way, after reading this book, I am absolutely astounded at how great a mathematician Jacobi was. He developed the $q$-series methods that enabled him to get explicit formulae for the number of representations on any integer as the sum of a number of squares or triangular numbers. Reading a list of his accomplishments is, like wow! He and Ramanujan would have gotten along famously.

• Thanks for the post, will add to my reading list =) – Loadge Mar 6 '13 at 6:48