%I #39 Nov 05 2024 15:07:08
%S 1,1,1,1,1,0,1,1,1,0,1,2,1,1,0,1,2,2,2,0,0,1,2,3,3,2,1,0,1,2,4,5,5,2,
%T 1,0,1,2,5,8,8,6,3,0,1,1,3,6,11,14,13,7,4,1,0,1,3,7,15,23,24,19,10,3,
%U 1,0,1,3,8,20,34,43,39,25,13,3,1,0,1,3,9,26,49,71,74,60,34,14,5,0,0
%N Number T(n,k) of k-element subsets of [n] having a square element sum; triangle T(n,k), n>=0, 0<=k<=n, read by rows.
%H Alois P. Heinz, <a href="/A281871/b281871.txt">Rows n = 0..200, flattened</a>
%F T(n,n) = 1 for n in { A001108 }, T(n,n) = 0 otherwise.
%F T(n,n-1) = 1 for n in { A214857 }, T(n,n-1) = 0 for n in { A214858 }.
%F Sum_{k=0..n} k * T(n,k) = A377572(n).
%e T(7,0) = 1: {}.
%e T(7,1) = 2: {1}, {4}.
%e T(7,2) = 4: {1,3}, {2,7}, {3,6}, {4,5}.
%e T(7,3) = 5: {1,2,6}, {1,3,5}, {2,3,4}, {3,6,7}, {4,5,7}.
%e T(7,4) = 5: {1,2,6,7}, {1,3,5,7}, {1,4,5,6}, {2,3,4,7}, {2,3,5,6}.
%e T(7,5) = 2: {1,2,3,4,6}, {3,4,5,6,7}.
%e T(7,6) = 1: {1,2,4,5,6,7}.
%e T(7,7) = 0.
%e T(8,8) = 1: {1,2,3,4,5,6,7,8}.
%e Triangle T(n,k) begins:
%e 1;
%e 1, 1;
%e 1, 1, 0;
%e 1, 1, 1, 0;
%e 1, 2, 1, 1, 0;
%e 1, 2, 2, 2, 0, 0;
%e 1, 2, 3, 3, 2, 1, 0;
%e 1, 2, 4, 5, 5, 2, 1, 0;
%e 1, 2, 5, 8, 8, 6, 3, 0, 1;
%e 1, 3, 6, 11, 14, 13, 7, 4, 1, 0;
%e 1, 3, 7, 15, 23, 24, 19, 10, 3, 1, 0;
%e 1, 3, 8, 20, 34, 43, 39, 25, 13, 3, 1, 0;
%e 1, 3, 9, 26, 49, 71, 74, 60, 34, 14, 5, 0, 0;
%e ...
%p b:= proc(n, s) option remember; expand(`if`(n=0,
%p `if`(issqr(s), 1, 0), b(n-1, s)+x*b(n-1, s+n)))
%p end:
%p T:= n-> (p-> seq(coeff(p, x, i), i=0..n))(b(n, 0)):
%p seq(T(n), n=0..16);
%t b[n_, s_] := b[n, s] = Expand[If[n == 0, If[IntegerQ @ Sqrt[s], 1, 0], b[n - 1, s] + x*b[n - 1, s + n]]];
%t T[n_] := Function[p, Table[Coefficient[p, x, i], {i, 0, n}]][b[n, 0]];
%t Table[T[n], {n, 0, 10}] // Flatten (* _Jean-François Alcover_, Jun 03 2018, from Maple *)
%Y Columns k=0-10 give: A000012, A000196, A176615, A281706, A281864, A281865, A281866, A281867, A281868, A281869, A281870.
%Y Main diagonal is characteristic function of A001108.
%Y Diagonals T(n+k,n) for k=2-10 give: A281965, A281966, A281967, A281968, A281969, A281970, A281971, A281972, A281973.
%Y Row sums give A126024.
%Y T(2n,n) gives A281872.
%Y Cf. A000217, A000290, A007318, A214857, A214858, A278339, A281994, A284249, A377572.
%K nonn,tabl,changed
%O 0,12
%A _Alois P. Heinz_, Jan 31 2017