OFFSET
1,1
COMMENTS
REFERENCES
G. H. Hardy and E. M. Wright, An Introduction to the Theory of Numbers. 3rd ed., Oxford Univ. Press, 1954, p. 311.
LINKS
Ray Chandler, Table of n, a(n) for n = 1..10000
Eric Weisstein's World of Mathematics, Square Number.
FORMULA
Legendre: a nonnegative integer is a sum of three (or fewer) squares iff it is not of the form 4^k m with m == 7 (mod 8).
MATHEMATICA
Select[Range[150], SquaresR[3, #]>0&&SquaresR[2, #]==0&] (* Harvey P. Dale, Nov 01 2011 *)
PROG
(Haskell)
a000419 n = a000419_list !! (n-1)
a000419_list = filter ((== 3) . a002828) [1..]
-- Reinhard Zumkeller, Feb 26 2015
(PARI) is(n)=my(f=factor(n)); for(i=1, #f[, 1], if(f[i, 2]%2 && f[i, 1]%4==3, return( n/4^valuation(n, 4)%8 !=7 ))); 0 \\ Charles R Greathouse IV, Feb 07 2017
(Python)
def aupto(lim):
squares = [k*k for k in range(1, int(lim**.5)+2) if k*k <= lim]
sum2sqs = set(a+b for i, a in enumerate(squares) for b in squares[i:])
sum3sqs = set(a+b for a in sum2sqs for b in squares)
return sorted(set(range(lim+1)) & (sum3sqs - sum2sqs - set(squares)))
print(aupto(142)) # Michael S. Branicky, Mar 06 2021
CROSSREFS
KEYWORD
nonn,nice,easy
AUTHOR
EXTENSIONS
More terms from Arlin Anderson (starship1(AT)gmail.com)
STATUS
approved