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.

A178786 Express n as the sum of four squares, x^2+y^2+z^2+w^2, with x>=y>=z>=w>=0, maximizing the value of x. Then a(n) is that x.

This page as a plain text file.
%I A178786 #23 Feb 26 2024 19:17:09
%S A178786 0,1,1,1,2,2,2,2,2,3,3,3,3,3,3,3,4,4,4,4,4,4,4,3,4,5,5,5,5,5,5,5,4,5,
%T A178786 5,5,6,6,6,6,6,6,6,5,6,6,6,6,6,7,7,7,7,7,7,7,6,7,7,7,7,7,7,7,8,8,8,8,
%U A178786 8,8,8,7,8,8,8,8,8,8,8,7,8,9,9,9,9,9,9,9,8,9,9,9,9,9,9,9,8,9,9,9,10,10,10,10,10,10,10,9,10,10,10,10,10,10,10,9,10
%N A178786 Express n as the sum of four squares, x^2+y^2+z^2+w^2, with x>=y>=z>=w>=0, maximizing the value of x. Then a(n) is that x.
%C A178786 Lagrange's theorem tells us that each positive integer can be written as a sum of four squares.
%H A178786 David Consiglio, Jr., <a href="/A178786/b178786.txt">Table of n, a(n) for n = 0..10000</a>
%H A178786 David Consiglio, Jr., <a href="/A178786/a178786.txt">Python program</a>
%o A178786 (Python)
%o A178786 from math import *
%o A178786 for nbre in range(0, 500): # or more than 500 !
%o A178786     maxc4=0
%o A178786     for c1 in range(0, int(sqrt(nbre/4))+1):
%o A178786         for c2 in range(c1, int(sqrt(nbre/3))+1):
%o A178786             for c3 in range(c2, int(sqrt(nbre/2))+1):
%o A178786                 s3=c3**2+c2**2+c1**2
%o A178786                 if s3<=nbre:
%o A178786                     c4=sqrt(nbre-s3)
%o A178786                     if int(c4)==c4 and c4>=c3:
%o A178786                         if c4>maxc4:
%o A178786                             maxc4=int(c4)
%o A178786     print(maxc4, end=', ')
%Y A178786 Cf. A122922, A122923, A122924, A122925, A122926, A122927, A002330, A122921.
%Y A178786 Analogs for 3 squares: A261904 and A261915.
%K A178786 nonn
%O A178786 0,5
%A A178786 _Sébastien Dumortier_, Jun 24 2011