A259919 Number of n X n upper triangular matrices (m_{i,j}) of nonnegative integers with 2 = Sum_{j=h..n} m_{h,j} - Sum_{i=1..h-1} m_{i,h} for all h in {1,...,n}.
1, 1, 3, 22, 351, 11275, 689146, 76718466, 15016410213, 5018597151979, 2793390337774000, 2534303740130716491, 3677548139455638020060, 8393668597786379602398164, 29683833854927200499142474520, 160463839044675821511377573062150, 1309702228155431081923017737636343876
Offset: 0
Keywords
Examples
a(2) = 3: [1,1; 0,3], [2,0; 0,2], [0,2; 0,4].
Programs
-
Maple
b:= proc(n, i, l) option remember; (m-> `if`(m=0, 1, `if`(i=0, b(l[1]+2, m-1, subsop(1=NULL, l)), add( b(n-j, i-1, subsop(i=l[i]+j, l)), j=0..n))))(nops(l)) end: a:= n-> b(2, n-1, [0$(n-1)]): seq(a(n), n=0..10);
-
Mathematica
b[n_, i_, l_] := b[n, i, l] = With[{m = Length[l]}, If[m == 0, 1, If[i == 0, b[l[[1]] + 2, m - 1, ReplacePart[l, 1 -> Nothing]], Sum[ b[n - j, i - 1, ReplacePart[l, i -> l[[i]] + j]], {j, 0, n}]]]]; a[n_] := If[n <= 1, 1, b[2, n - 1, Array[0&, n - 1]]]; Table[Print[n, " ", a[n]]; a[n], {n, 0, 14}] (* Jean-François Alcover, May 17 2022, after Alois P. Heinz *)
Comments