login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 59th year, we have over 358,000 sequences, and we’ve crossed 10,300 citations (which often say “discovered thanks to the OEIS”).

Other ways to Give
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
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. 4
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, 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, 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 (list; graph; refs; listen; history; text; internal format)
OFFSET

0,5

COMMENTS

Lagrange's theorem tells us that each positive integer can be written as a sum of four squares.

LINKS

David Consiglio, Jr., Table of n, a(n) for n = 0..10000

David Consiglio, Jr., Python program

PROG

Python code :

from math import *

for nbre in range(0, 500): # or more than 500 !

....maxc4=0

....for c1 in range(0, sqrt(nbre/4)+1):

........for c2 in range(c1, sqrt(nbre/3)+1):

............for c3 in range(c2, sqrt(nbre/2)+1):

................s3=c3**2+c2**2+c1**2

................if s3<=nbre:

....................c4=sqrt(nbre-s3)

....................if int(c4)==c4 and c4>=c3:

........................if c4>maxc4:

............................maxc4=int(c4)

....print '%d, ' % maxc4,

CROSSREFS

Cf. A122922, A122923, A122924, A122925, A122926, A122927, A002330, A122921.

Analogs for 3 squares: A261904 and A261915.

Sequence in context: A227581 A263846 A350088 * A350174 A000196 A111850

Adjacent sequences:  A178783 A178784 A178785 * A178787 A178788 A178789

KEYWORD

nonn

AUTHOR

Sébastien Dumortier, Jun 24 2011

STATUS

approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified November 26 07:57 EST 2022. Contains 358354 sequences. (Running on oeis4.)