Conditionals: Sum of Squares

 

screen-shot-2016-10-27-at-8-36-29-am

A positive integer n is called squarefree, if no square of a prime divides n, thus 1, 2, 3, 5, 6, 7, 10, 11 are squarefree, but not 4, 8, 9, 12.

Consider equations of the form: a2 + b2 = N, 0 ≤ a ≤ bab and N integer.

For N=65 there are two solutions:

a=1, b=8 and a=4, b=7.

We call S(N) the sum of the values of a of all solutions of a2 + b2 = N, 0 ≤ a ≤ b, where ab and N  are integers.

Thus S(65) = 1 + 4 = 5.

Find ∑S(N), for all squarefree N only divisible by primes of the form 4k+1 with 4k+1 < 150.