← RoseCode

ROSECODE 417

Bonus for p416

Min_25 · Math ·

Let r3(n)=#{(x,y,z)Z3x2+y2+z2=n}.

For example, r3(0)=1, r3(1)=6 and r3(100)=30.

Let S(n,m)=k=0m1r3(n+k).

It can be verified that S(1,100)=4168 and S(108,100)=6410310.

Find S(1017,100).

[My timing: 2.6 seconds (PyPy)]

Note: It would be hard without parigp and some papers.