%I #8 Nov 20 2021 09:35:39
%S 204,221,236,240,249,255,260,261,268,269,272,276,279,281,284,285,288,
%T 289,293,295,296,299,300,303,305,306,309,311,312,316,317,320,321,323,
%U 324,325,326,327,329,332,333,335,336,337,338,339,340,341,344,345,347,348
%N Numbers that are the sum of exactly 8 distinct nonzero squares.
%H Reinhard Zumkeller, <a href="/A224983/b224983.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 + 64 = 204 = A000330(8);
%e a(2) = 1 + 4 + 9 + 16 + 25 + 36 + 49 + 81 = 221;
%e a(3) = 1 + 4 + 9 + 16 + 25 + 36 + 64 + 81 = 236;
%e a(4) = 1 + 4 + 9 + 16 + 25 + 36 + 49 + 100 = 240;
%e a(5) = 1 + 4 + 9 + 16 + 25 + 49 + 64 + 81 = 249.
%t nmax = 1000;
%t S[n_] := S[n] = Union[Total /@ Subsets[
%t Range[Floor[Sqrt[n]]]^2, {8}]][[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 a224983 n = a224983_list !! (n-1)
%o a224983_list = filter (p 8 $ 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, A224982, A000290.
%K nonn
%O 1,1
%A _Reinhard Zumkeller_, Apr 22 2013
|