cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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.

This page as a plain text file.
%I A307531 #22 Jun 28 2022 09:34:33
%S A307531 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,
%T A307531 8,11,10,11,12,11,12,11,12,11,12,13,12,13,12,13,12,13,14,13,14,13,14,
%U A307531 13,12,15,14,15,14,15,14,15,16,15,16,15,16,15,16,15
%N 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.
%C A307531 The sequence is well defined as every nonnegative integer can be represented as a sum of four squares in at least one way.
%C A307531 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
%H A307531 Robert Israel, <a href="/A307531/b307531.txt">Table of n, a(n) for n = 0..10000</a>
%H A307531 Rémy Sigrist, <a href="/A307531/a307531.txt">C program for A307531</a>
%H A307531 Wikipedia, <a href="https://en.wikipedia.org/wiki/Lagrange%27s_four-square_theorem">Lagrange's four-square theorem</a>
%e A307531 For n = 34:
%e A307531 - 34 can be expressed in 4 ways as a sum of four squares:
%e A307531     i^2 + j^2 + k^2 + l^2   i+j+k+l
%e A307531     ---------------------   -------
%e A307531     0^2 + 0^2 + 3^2 + 5^2         8
%e A307531     0^2 + 3^2 + 3^2 + 4^2        10
%e A307531     1^2 + 1^2 + 4^2 + 4^2        10
%e A307531     1^2 + 2^2 + 2^2 + 5^2        10
%e A307531 - a(34) = max(8, 10) = 10.
%p A307531 g:= proc(n,k) option remember; local a;
%p A307531   if k = 1 then if issqr(n) then return sqrt(n) else return -infinity fi fi;
%p A307531   max(seq(a+procname(n-a^2,k-1),a=0..floor(sqrt(n))))
%p A307531 end proc:
%p A307531 seq(g(n,4), n=0..100); # _Robert Israel_, Apr 14 2019
%t A307531 Array[Max[Total /@ PowersRepresentations[#, 4, 2]] &, 68, 0] (* _Michael De Vlieger_, Apr 13 2019 *)
%o A307531 (C) See Links section.
%Y A307531 See A307510 for the multiplicative variant.
%Y A307531 Cf. A002635, A354777.
%K A307531 nonn
%O A307531 0,3
%A A307531 _Rémy Sigrist_, Apr 13 2019