OFFSET
0,2
COMMENTS
When n is not of the form 4^a * (8b + 7), according to Legendre's three-square theorem, n = x^2 + y^2 + z^2 = x^2 + y^2 + z^2 + 0^3 (where a, b, x, y and z are nonnegative integers with x <= y <= z).
If n = 8b + 7, then n - 1 = 8b + 6 is not of the form 4^a * (8b + 7). So n = (n - 1) + 1 = x^2 + y^2 + z^2 + 1^3.
If n = 4 * (8b + 7), then n - 1 = 8 * (4b + 3) + 3 is also not of the form 4^a * (8b + 7).
If n = 4^2 * (8b + 7), then n - 8 = 4 * (8 * (4b + 3) + 2) is not of the form 4^a * (8b + 7). n = (n - 8) + 8 = x^2 + y^2 + z^2 + 2^3.
If n = 4^k * (8b + 7) (k >= 3), then n - 8 = 4 * (8 * (4^(k - 1) * b + 4^(k - 3) * 14) - 2) = 4 * (8m - 2) is also not of the form 4^a * (8b + 7).
That is, every nonnegative integer can be represented as the sum of 3 squares and a nonnegative cube, so a(n) > 0.
LINKS
Robert Israel, Table of n, a(n) for n = 0..10000
Wikipedia, Legendre's three-square theorem
EXAMPLE
2 = 0^2 + 0^2 + 1^2 + 1^3 = 0^2 + 1^2 + 0^2 + 1^3, a(2) = 2.
9 = 0^2 + 0^2 + 1^2 + 2^3 = 0^2 + 1^2 + 0^2 + 2^3 = 0^2 + 2^2 + 2^2 + 1^3 = 1^2 + 2^2 + 2^2 + 0^3, a(9) = 4.
MAPLE
N:= 100: # to get a(0)..a(N)
A:= Array(0..N):
for x from 0 to floor(sqrt(N)) do
for y from 0 to x while x^2 + y^2 <= N do
for z from 0 to y while x^2 + y^2 + z^2 <= N do
for w from 0 do
t:= x^2 + y^2 + z^2 + w^3;
if t > N then break fi;
A[t]:= A[t]+1;
od od od od:
convert(A, list); # Robert Israel, Jan 11 2018
MATHEMATICA
a[n_]:=Sum[If[x^2+y^2+z^2+w^3==n, 1, 0], {x, 0, n^(1/2)}, {y, x, (n-x^2)^(1/2)}, {z, y, (n-x^2-y^2)^(1/2)}, {w, 0, (n-x^2-y^2-z^2)^(1/3)}]
Table[a[n], {n, 0, 86}]
CROSSREFS
KEYWORD
nonn
AUTHOR
XU Pingya, Jan 06 2018
STATUS
approved