TITLE: Sum of squares of sum of squares function $r_2(n)$
QUESTION [5 upvotes]: 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$?

REPLY [3 votes]: 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.