login
Sum of a^2 + b^2 for all nonnegative integers a,b such that b^2-a^2 = 4n.
2

%I #32 Oct 06 2019 09:19:38

%S 4,10,20,50,52,100,100,170,200,260,244,420,340,500,520,714,580,910,

%T 724,1092,1000,1220,1060,1700,1352,1700,1640,2100,1684,2600,1924,2730,

%U 2440,2900,2600,3894,2740,3620,3400,4420,3364,5000,3700,5124,4732,5300,4420,6820,5000

%N Sum of a^2 + b^2 for all nonnegative integers a,b such that b^2-a^2 = 4n.

%C In the first 50 entries, the final digit is either 0, 2, or 4. Does 6 or 8 ever occur as the last digit?

%C a(121) = 29768, a(605) = 767676. - _Alois P. Heinz_, Apr 24 2014

%H Alois P. Heinz, <a href="/A237626/b237626.txt">Table of n, a(n) for n = 1..10000</a>

%F For each pair of divisors d and d' of 4n with d*d'=4n and d<=d' find a and b satisfying b-a=d and b+a=d' and compute a^2+b^2. Add all of the results together.

%e When n=12, we get 4*12=48 and then 48 = 13^2-11^2 = 8^2-4^2 = 7^2-1^2. So a(12) = 1^2+7^2+4^2+8^2+11^2+13^2 = 420.

%t a[n_] := Module[{a, b}, a^2 + b^2 /. {ToRules[Reduce[0 <= a < b && b^2 - a^2 == 4n, {a, b}, Integers]]} // Total];

%t a /@ Range[1, 50] (* _Jean-François Alcover_, Oct 06 2019 *)

%o (PARI) a(n)=my(b);sum(a=0,n-1,if(issquare(a^2+4*n,&b),a^2+b^2)) \\ _Charles R Greathouse IV_, Apr 22 2014

%K nonn

%O 1,1

%A _J. M. Bergot_, Apr 22 2014