|
|
A307531
|
|
a(n) is the greatest sum i + j + k + l where i^2 + j^2 + k^2 + l^2 = n and 0 <= i <= j <= k <= l.
|
|
3
|
|
|
0, 1, 2, 3, 4, 3, 4, 5, 4, 5, 6, 5, 6, 7, 6, 7, 8, 7, 8, 7, 8, 9, 8, 9, 8, 9, 10, 9, 10, 9, 10, 11, 8, 11, 10, 11, 12, 11, 12, 11, 12, 11, 12, 13, 12, 13, 12, 13, 12, 13, 14, 13, 14, 13, 14, 13, 12, 15, 14, 15, 14, 15, 14, 15, 16, 15, 16, 15, 16, 15, 16, 15
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,3
|
|
COMMENTS
|
The sequence is well defined as every nonnegative integer can be represented as a sum of four squares in at least one way.
It appears that a(n^2) = 2*n if n is even and 2*n-1 if n is odd. - Robert Israel, Apr 14 2019
|
|
LINKS
|
|
|
EXAMPLE
|
For n = 34:
- 34 can be expressed in 4 ways as a sum of four squares:
i^2 + j^2 + k^2 + l^2 i+j+k+l
--------------------- -------
0^2 + 0^2 + 3^2 + 5^2 8
0^2 + 3^2 + 3^2 + 4^2 10
1^2 + 1^2 + 4^2 + 4^2 10
1^2 + 2^2 + 2^2 + 5^2 10
- a(34) = max(8, 10) = 10.
|
|
MAPLE
|
g:= proc(n, k) option remember; local a;
if k = 1 then if issqr(n) then return sqrt(n) else return -infinity fi fi;
max(seq(a+procname(n-a^2, k-1), a=0..floor(sqrt(n))))
end proc:
|
|
MATHEMATICA
|
Array[Max[Total /@ PowersRepresentations[#, 4, 2]] &, 68, 0] (* Michael De Vlieger, Apr 13 2019 *)
|
|
PROG
|
(C) See Links section.
|
|
CROSSREFS
|
See A307510 for the multiplicative variant.
|
|
KEYWORD
|
nonn
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|