OFFSET
0,3
LINKS
Alois P. Heinz, Antidiagonals n = 0..70, flattened
EXAMPLE
Square array A(n,k) begins:
0 : 1, 1, 1, 1, 1, 1, ...
1 : 4, 2, 3, 2, 3, 2, ...
2 : 256, 16, 50, 36, 56, 16, ...
3 : 46656, 216, 1626, 1440, 2688, 720, ...
4 : 16777216, 4096, 83736, 84624, 215760, 94816, ...
5 : 10000000000, 100000, 6026120, 7675200, 24899120, 11218000, ...
MAPLE
with(numtheory): with(combinat): M:=multinomial:
b:= proc(n, k, p) local l, g; l, g:= sort([divisors(p)[]]),
proc(k, m, i, t) option remember; local d, j; d:= l[i];
`if`(i=1, n^m, add(M(k, k-(d-t)*j, (d-t)$j)/j!*
(d-1)!^j *M(m, m-t*j, t$j) *g(k-(d-t)*j, m-t*j,
`if`(d-t=1, [i-1, 0], [i, t+1])[]), j=0..min(k/(d-t),
`if`(t=0, [][], m/t))))
end; g(k, n-k, nops(l), 0)
end:
A:= (n, k)-> `if`(k=0, (2*n)^(2*n), b(2*n, n, k)):
seq(seq(A(n, d-n), n=0..d), d=0..10);
MATHEMATICA
multinomial[n_, k_List] := n!/Times @@ (k!); M = multinomial;
b[n_, k0_, p_] := Module[{l, g}, l = Divisors[p];
g[k_, m_, i_, t_] := g[k, m, i, t] = Module[{d, j}, d = l[[i]];
If[i == 1, If[m == 0, 1, n^m], Sum[M[k, Join[{k - (d - t)*j},
Table[d - t, {j}]]]/j!*If[j == 0, 1, (d - 1)!^j]*M[m, Join[{m - t*j},
Array[t&, j]]]*g[k - (d - t)*j, m - t*j, Sequence @@
If[d - t == 1, {i - 1, 0}, {i, t + 1}]], {j, 0, Min[k/(d - t),
If[t == 0, {}, m/t]]}]]];
g[k0, n - k0, Length[l], 0]];
A[n_, k_] := If[k == 0, If[n == 0, 1, (2n)^(2n)], b[2*n, n, k]];
Table[A[n, d - n], {d, 0, 10}, {n, 0, d}] // Flatten (* Jean-François Alcover, May 27 2016, after Alois P. Heinz, updated Jan 01 2021 *)
CROSSREFS
KEYWORD
nonn,tabl
AUTHOR
Alois P. Heinz, Aug 12 2014
STATUS
approved