login

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”).

Numbers that are the sum of exactly 7 distinct nonzero squares.
8

%I #8 Nov 20 2021 09:35:33

%S 140,155,168,172,179,185,188,191,195,196,200,203,204,205,211,212,215,

%T 217,219,220,224,225,227,230,231,232,233,235,236,239,240,243,244,245,

%U 246,247,248,251,252,254,256,257,259,260,263,264,265,267,268,269,270,271

%N Numbers that are the sum of exactly 7 distinct nonzero squares.

%H Reinhard Zumkeller, <a href="/A224982/b224982.txt">Table of n, a(n) for n = 1..1000</a>

%H Paul T. Bateman, Adolf J. Hildebrand, and George B. Purdy, <a href="http://matwbn.icm.edu.pl/ksiazki/aa/aa67/aa6745.pdf">Sums of distinct squares</a>, Acta Arithmetica 67 (1994), pp. 349-380.

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

%e a(1) = 1 + 4 + 9 + 16 + 25 + 36 + 49 = 140 = A000330(7);

%e a(2) = 1 + 4 + 9 + 16 + 25 + 36 + 64 = 155;

%e a(3) = 1 + 4 + 9 + 16 + 25 + 49 + 64 = 168;

%e a(4) = 1 + 4 + 9 + 16 + 25 + 36 + 81 = 172;

%e a(5) = 1 + 4 + 9 + 16 + 36 + 49 + 64 = 179.

%t nmax = 1000;

%t S[n_] := S[n] = Union[Total /@ Subsets[

%t Range[Floor[Sqrt[n]]]^2, {7}]][[1 ;; nmax]];

%t S[nmax];

%t S[n = nmax + 1];

%t While[S[n] != S[n - 1], n++];

%t S[n] (* _Jean-François Alcover_, Nov 20 2021 *)

%o (Haskell)

%o a224982 n = a224982_list !! (n-1)

%o a224982_list = filter (p 7 $ 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)

%Y Cf. A003995, A004431, A004432, A004433, A004434, A224981, A224983, A000290.

%K nonn

%O 1,1

%A _Reinhard Zumkeller_, Apr 22 2013