[go: up one dir, main page]

login
Numbers that are the sum of 4 distinct nonzero squares: of form w^2+x^2+y^2+z^2 with 0<w<x<y<z.
17

%I #31 Aug 02 2023 07:11:56

%S 30,39,46,50,51,54,57,62,63,65,66,70,71,74,75,78,79,81,84,85,86,87,90,

%T 91,93,94,95,98,99,102,105,106,107,109,110,111,113,114,116,117,118,

%U 119,120,121,122,123,125,126,127,129,130,131,133,134,135,137

%N Numbers that are the sum of 4 distinct nonzero squares: of form w^2+x^2+y^2+z^2 with 0<w<x<y<z.

%H T. D. Noe, <a href="/A004433/b004433.txt">Table of n, a(n) for n = 1..1000</a>

%H <a href="/index/Su#ssq">Index entries for sequences related to sums of squares</a>

%F {n: A025443(n) >=1}. Union of A025386 and A025376. - _R. J. Mathar_, Jun 15 2018

%e 30 = 1^2+2^2+3^2+4^2.

%t data = Flatten[ DeleteCases[ FindInstance[ w^2 + x^2 + y^2 + z^2 == # && 0 < w < x < y < z < #, {w, x, y, z}, Integers] & /@ Range[137], {}], 1]; w^2 + x^2 + y^2 + z^2 /. data (* _Ant King_, Oct 17 2010 *)

%t Select[Union[Total[#^2]&/@Subsets[Range[10],{4}]],#<=137&] (* _Harvey P. Dale_, Jul 03 2011 *)

%o (Haskell)

%o a004433 n = a004433_list !! (n-1)

%o a004433_list = filter (p 4 $ tail a000290_list) [1..] where

%o p k (q:qs) m = k == 0 && m == 0 ||

%o q <= m && k >= 0 && (p (k - 1) qs (m - q) || p k qs m)

%o -- _Reinhard Zumkeller_, Apr 22 2013

%o (PARI) list(lim)=my(v=List()); lim\=1; for(z=4,sqrtint(lim\4), for(y=3,min(sqrtint((lim-z^2)\3),z-1), for(x=2,min(sqrtint((lim-y^2-z^2)\2),y-1), for(w=1,min(sqrtint(lim-x^2-y^2-z^2),x-1), listput(v,w^2+x^2+y^2+z^2))))); Set(v) \\ _Charles R Greathouse IV_, Feb 07 2017

%Y Cf. A001944, A001995, A003995, A004431, A004432, A004434, A224981, A224982, A224983, A000290.

%K nonn,easy,nice

%O 1,1

%A _N. J. A. Sloane_