login
Number of nonnegative solutions to x^2 + y^2 + z^2 + u^2 <= n.
9

%I #12 Apr 08 2021 12:58:47

%S 1,5,11,15,20,32,44,48,54,70,88,100,108,124,148,160,165,189,219,235,

%T 253,281,305,317,329,357,399,427,439,475,523,539,545,581,623,659,688,

%U 716,764,792,810,858,918,946,970,1030,1078,1102,1110,1154,1226,1274,1304,1352

%N Number of nonnegative solutions to x^2 + y^2 + z^2 + u^2 <= n.

%F G.f.: (1/(1 - x))*(Sum_{k>=0} x^(k^2))^4. - _Ilya Gutkovskiy_, Mar 14 2017

%t nn = 50; t = Table[0, {nn}]; Do[d = x^2 + y^2 + z^2 + u^2; If[0 < d <= nn, t[[d]]++], {x, 0, nn}, {y, 0, nn}, {z, 0, nn}, {u, 0, nn}]; Accumulate[Join[{1}, t]] (* _T. D. Noe_, Apr 01 2013 *)

%o (Python)

%o for n in range(99):

%o k = 0

%o for x in range(99):

%o s = x*x

%o if s>n: break

%o for y in range(99):

%o sy = s + y*y

%o if sy>n: break

%o for z in range(99):

%o sz = sy + z*z

%o if sz>n: break

%o for u in range(99):

%o su = sz + u*u

%o if su>n: break

%o k+=1

%o print(str(k), end=', ')

%Y Cf. A014110 (first differences).

%Y Cf. A224212 (number of nonnegative solutions to x^2 + y^2 <= n).

%Y Cf. A000606 (number of nonnegative solutions to x^2 + y^2 + z^2 <= n).

%Y Cf. A046895 (number of integer solutions to x^2 + y^2 + z^2 + u^2 <= n).

%K nonn

%O 0,2

%A _Alex Ratushnyak_, Apr 01 2013