# Sum of squares function

The function rk(x) denotes the number of ways an integer x can be expressed as the sum of squares of k integers [the integers can be positive, can be negative, can be zero].

What is the value of r2(2013) + r2(2013-1) + r2(2013-4) + r2(2013-9) + r2(2013-16) + r2(2013-25) + ... + r2(2013-44^2)?

Note that 2013-45^2 is negative, so r2(2013-p^2) is always 0 if p>44.

My approach is as follows. A general term in the question is of the form r2(2013-k^2). It is the number of integer solutions of a^2 + b^2= 2013-k^2 -> a^2 + b^2 + k^2= 2013. So the answer should be r3(2013).

I searched for the function r3 but everywhere I saw complex calculations and use of calculus. Can anybody please give me a simple computation of r3(2013)?

Note:- WolframAlpha gives the answer 192, but I want a mathematical argument.

-
There is no simple formula. I believe that your motivation for this problem (and several others that you posed) comes from Brilliant.org, namely finding integer solutions to $x^2 + y^2 + z^2 = 2013$. – Calvin Lin Apr 7 '13 at 3:51
You might find this helpful, mathworld.wolfram.com/SumofSquaresFunction.html – i707107 Apr 7 '13 at 4:06
@CalvinLin : because of your comment, I flagged this question. – Stefan Smith Apr 7 '13 at 20:44
@CalvinLin: can you provide a link to the question at brilliant.org? counting and finding the solutions seem different. The appearance of 2013 does seem suspicious, however. – robjohn Apr 8 '13 at 7:11
@robjohn Certainly here it is. There have been several of these $x^2+y^2+z^2=2013$ requests, like this other post from a user who only gives Brilliant problems (but I haven't been quick enough to crack down. – Calvin Lin Apr 8 '13 at 13:23