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 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).
%I #32 Mar 06 2021 12:57:09
%S 3,6,11,12,14,19,21,22,24,27,30,33,35,38,42,43,44,46,48,51,54,56,57,
%T 59,62,66,67,69,70,75,76,77,78,83,84,86,88,91,93,94,96,99,102,105,107,
%U 108,110,114,115,118,120,123,126,129,131,132,133,134,138,139,140,141,142
%N Numbers that are the sum of 3 but no fewer nonzero squares.
%C A002828(a(n)) = 3; A025427(a(n)) > 0. - _Reinhard Zumkeller_, Feb 26 2015
%D G. H. Hardy and E. M. Wright, An Introduction to the Theory of Numbers. 3rd ed., Oxford Univ. Press, 1954, p. 311.
%H Ray Chandler, <a href="/A000419/b000419.txt">Table of n, a(n) for n = 1..10000</a>
%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/SquareNumber.html">Square Number.</a>
%H <a href="/index/Su#ssq">Index entries for sequences related to sums of squares</a>
%F 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).
%t Select[Range[150],SquaresR[3,#]>0&&SquaresR[2,#]==0&] (* _Harvey P. Dale_, Nov 01 2011 *)
%o (Haskell)
%o a000419 n = a000419_list !! (n-1)
%o a000419_list = filter ((== 3) . a002828) [1..]
%o -- _Reinhard Zumkeller_, Feb 26 2015
%o (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
%o (Python)
%o def aupto(lim):
%o squares = [k*k for k in range(1, int(lim**.5)+2) if k*k <= lim]
%o sum2sqs = set(a+b for i, a in enumerate(squares) for b in squares[i:])
%o sum3sqs = set(a+b for a in sum2sqs for b in squares)
%o return sorted(set(range(lim+1)) & (sum3sqs - sum2sqs - set(squares)))
%o print(aupto(142)) # _Michael S. Branicky_, Mar 06 2021
%Y Cf. A000378, A000408, A000415, A002828, A004215, A025427.
%K nonn,nice,easy
%O 1,1
%A _N. J. A. Sloane_ and _J. H. Conway_
%E More terms from Arlin Anderson (starship1(AT)gmail.com)