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.
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
Offset: 0
Keywords
Links
- David Consiglio, Jr., Table of n, a(n) for n = 0..10000
- David Consiglio, Jr., Python program
Crossrefs
Programs
-
Python
from math import * for nbre in range(0, 500): # or more than 500 ! maxc4=0 for c1 in range(0, int(sqrt(nbre/4))+1): for c2 in range(c1, int(sqrt(nbre/3))+1): for c3 in range(c2, int(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(maxc4, end=', ')
Comments