OFFSET
1,1
COMMENTS
REFERENCES
T. Nagell, Introduction to Number Theory, Wiley, 1951, p. 194.
LINKS
Chai Wah Wu, Table of n, a(n) for n = 1..10000 (terms 1..3140 from Robert Israel)
O. Fraser and B. Gordon, On representing a square as the sum of three squares, Amer. Math. Monthly, 76 (1969), 922-923.
FORMULA
For n >= 32, a(n) = (n+m+1)^2 if n+m >= A094958(m+1) and a(n) = (n+m)^2 otherwise, where m = A070939(n)+A070939(floor(n/5)). - Chai Wah Wu, Jan 25 2026
EXAMPLE
9 = 1 + 4 + 4,
36 = 16 + 16 + 4,
49 = 36 + 9 + 4,
81 = 49 + 16 + 16,
so these are in the sequence.
16 cannot be written as the sum of 3 squares if zero is not allowed, therefore 16 is not in the sequence.
Also we can see that 49 - 36 - 9 - 4 = 0, so (7,6,3,2) is a null vector in the signatures (+,-,-,-) and (-,+,+,+). - Jon Perry, Oct 06 2012
MAPLE
M:= 10000: # to get all terms <= M
sort(convert(select(issqr, {seq(seq(seq(x^2 + y^2 + z^2,
z=y..floor(sqrt(M-x^2-y^2))), y=x..floor(sqrt((M-x^2)/2))),
x=1..floor(sqrt(M/3)))}), list)); # Robert Israel, Jan 28 2016
MATHEMATICA
Select[Range[58]^2, Resolve@ Exists[{x, y, z}, Reduce[# == x^2 + y^2 + z^2, {x, y, z}, Integers], And[x > 0, y > 0, z > 0]] &] (* Michael De Vlieger, Jan 27 2016 *)
PROG
(Python)
def A169580(n): return (9, 36, 49, 81, 121, 144, 169, 196, 225, 289, 324, 361, 441, 484, 529, 576, 625, 676, 729, 784, 841, 900, 961, 1089, 1156, 1225, 1296, 1369, 1444, 1521, 1681)[n-1] if n<32 else (n+(m:=n.bit_length()+(n//5).bit_length())+(n+m>=(1<<m if m<3 else 5<<((m+1>>1)-2) if m&1 else 1<<(m+1>>1)+1)))**2 # Chai Wah Wu, Jan 25 2026
(PARI) apply(sqr, select(n->!(if(n%5, n, n/5)==2^valuation(n, 2)), [1..58])) \\ Bruce Nye, May 28 2026
CROSSREFS
KEYWORD
nonn
AUTHOR
N. J. A. Sloane, Mar 02 2010
STATUS
approved
