OFFSET
0,3
LINKS
Andrew Howroyd, PARI Program, Mar 2023.
EXAMPLE
a(3) = 12 because there are 12 possible 3 X 3 matrices with nonnegative integer entries, row sums 1,2,3 and column sums 1,2,3:
[ 0 0 1 ] [ 0 0 1 ] [ 0 0 1 ] [ 0 0 1 ]
[ 0 0 2 ] [ 0 1 1 ] [ 0 2 0 ] [ 1 0 1 ]
[ 1 2 0 ], [ 1 1 1 ], [ 1 0 2 ], [ 0 2 1 ],
.
[ 0 0 1 ] [ 0 1 0 ] [ 0 1 0 ] [ 0 1 0 ]
[ 1 1 0 ] [ 0 0 2 ] [ 0 1 1 ] [ 1 0 1 ]
[ 0 1 2 ], [ 1 1 1 ], [ 1 0 2 ], [ 0 1 2 ],
.
[ 0 1 0 ] [ 1 0 0 ] [ 1 0 0 ] [ 1 0 0 ]
[ 1 1 0 ] [ 0 0 2 ] [ 0 1 1 ] [ 0 2 0 ]
[ 0 0 3 ], [ 0 2 1 ], [ 0 1 2 ], [ 0 0 3 ].
MAPLE
G:= proc(L, R, k) option remember;
# number of solutions with first k entries of first row 0
local m, n, i;
m:= nops(L); n:= nops(R);
if m <= 1 then return 1 fi;
if L[1] > convert(R[k+1..n], `+`) then return 0 fi;
if k = n-1 then return procname(L[2..-1], subsop(n = R[n]-L[1], R), 0) fi;
add(procname(subsop(1=L[1]-i, L), subsop(k+1=R[k+1]-i, R), k+1), i=0..min(L[1], R[k+1]))
end proc:
seq(G([$1..n], [$1..n], 0), n=0..8);
CROSSREFS
KEYWORD
nonn
AUTHOR
Robert Israel, Mar 23 2023
EXTENSIONS
a(10)-a(13) from Andrew Howroyd, Mar 29 2023
a(0)=1 prepended by Alois P. Heinz, Jun 26 2023
STATUS
approved