login
A395008
Numbers k representable as a sum of three squares at which the minimal three-square spread s3(k) reaches a new record value, where s3(k) is the least value of x-z over all representations k = x^2 + y^2 + z^2 with x >= y >= z >= 0.
1
1, 4, 10, 16, 37, 58, 64, 130, 148, 232, 256, 445, 520, 592, 928, 1024, 1780, 2080, 2368, 3712, 4096, 7120, 8320, 9472, 14848, 16384, 28480, 33280, 37888, 59392, 65536, 113920, 133120, 151552, 237568, 262144, 455680, 532480, 606208, 950272, 1048576, 1822720, 2129920, 2424832, 3801088, 4194304
OFFSET
1,2
COMMENTS
s3(k) is defined exactly when k is a sum of three squares; i.e., k is not of the form 4^a*(8b+7) (Legendre). It is the spread of the "most balanced" three-square representation. s3(k) = 0 iff k = 3*m^2, then x = y = z = m. This sequence lists the k where s3 reaches a new maximum.
The first six primitive record locations (terms not equal to 4 times an earlier record) are 1, 10, 37, 58, 130, 445, with respective spreads 1, 3, 6, 7, 9, 17. Since a sum of three squares is divisible by 4 only when all three squares are even, every representation of 4*k halves to one of k and conversely, giving s3(4*k) = 2*s3(k).
Five of these six primitive seeds (1, 10, 37, 58, 130) are among the initial terms of A051952; the sixth seed 445 = 20^2 + 6^2 + 3^2 is a sum of three positive squares and is not in A051952.
FORMULA
Conjecture: a(n) = 4*a(n-5) for n >= 13, with initial terms a(1)..a(12) = 1, 4, 10, 16, 37, 58, 64, 130, 148, 232, 256, 445.
EXAMPLE
k = 1: 1 = 1^2+0^2+0^2, spread 1-0 = 1 (first record).
k = 10: 10 = 3^2+1^2+0^2, spread 3-0 = 3 (new record).
k = 37: 37 = 6^2+1^2+0^2, spread 6-0 = 6 (new record).
k = 445: 445 = 20^2+6^2+3^2, spread 20-3 = 17 (new record; first record whose tightest triple has all three parts positive).
PROG
(PARI)
issum3(n) = {if(n<1, return(n==0)); while(n%4==0, n\=4); n%8 != 7};
s3(n) = {my(b=oo, zr=sqrtint(n\3)); forstep(z=zr, 0, -1, my(m=n-z^2, xl=sqrtint(m\2)); while(2*xl^2<m, xl++); if(xl-z>=b, break); for(x=xl, sqrtint(m), if(x-z>=b, break); my(y2=m-x^2); if(issquare(y2) && sqrtint(y2)>=z, b=x-z; break))); b};
lista(N) = {my(rec=-1); for(k=1, N, if(issum3(k), my(s=s3(k)); if(s>rec, rec=s; print1(k, ", "))))};
\\ lista(N) prints the record locations up to N.
CROSSREFS
Cf. A000378 (sums of three squares; the domain of s3), A004215 (numbers 4^a*(8b+7), excluded from the domain), A000408, A004214, A051952, A219222. A396760 is a related four-square balance-gap record-location sequence.
Sequence in context: A069982 A009883 A333904 * A163389 A172126 A025621
KEYWORD
nonn
AUTHOR
Nenad Micic, Jun 10 2026
STATUS
approved