OFFSET
0,6
LINKS
Alois P. Heinz, Antidiagonals n = 0..140, flattened
Wikipedia, D-ary heap
EXAMPLE
Square array A(n,k) begins:
: 1, 1, 1, 1, 1, 1, 1, 1, ...
: 1, 1, 1, 1, 1, 1, 1, 1, ...
: 2, 1, 1, 1, 1, 1, 1, 1, ...
: 6, 2, 1, 1, 1, 1, 1, 1, ...
: 24, 3, 2, 1, 1, 1, 1, 1, ...
: 120, 6, 3, 2, 1, 1, 1, 1, ...
: 720, 9, 4, 3, 2, 1, 1, 1, ...
: 5040, 24, 8, 4, 3, 2, 1, 1, ...
: 40320, 45, 12, 5, 4, 3, 2, 1, ...
MAPLE
with(combinat):
b:= proc(n, k) option remember; local h, i, x, y, z;
if n<2 then 1 elif k<2 then k
else h:= ilog[k]((k-1)*n+1);
if k^h=(k-1)*n+1 then b((n-1)/k, k)^k*
multinomial(n-1, ((n-1)/k)$k)
else x, y:=(k^h-1)/(k-1), (k^(h-1)-1)/(k-1);
for i from 0 do z:= (n-1)-(k-1-i)*y-i*x;
if y<=z and z<=x then b(y, k)^(k-1-i)*
multinomial(n-1, y$(k-1-i), x$i, z)*
b(x, k)^i*b(z, k); break fi
od
fi fi
end:
A:= (n, k)-> n!/b(n+1, k):
seq(seq(A(n, 1+d-n), n=0..d), d=0..14);
MATHEMATICA
multinomial[n_, k_List] := n!/Times @@ (k!); b[n_, k_] := b[n, k] = Module[{h, i, x, y, z}, Which[n<2, 1, k<2, k, True, h = Floor @ Log[k, (k - 1)*n + 1]; If [k^h == (k-1)*n+1, b[(n-1)/k, k]^k*multinomial[n-1, Array[(n-1)/k&, k]], {x, y} = {(k^h-1)/(k-1), (k^(h-1)-1)/(k-1)}; For[i = 0, True, i++, z = (n-1) - (k-1-i)*y - i*x; If[y <= z && z <= x, b[y, k]^(k-1-i)*multinomial[n-1, Join[Array[y&, k-1-i], Array[x&, i], {z}]] * b[x, k]^i*b[z, k] // Return]]]]]; A[n_, k_] := n!/b[n+1, k]; Table[A[n, 1+d-n], {d, 0, 14}, {n, 0, d}] // Flatten (* Jean-François Alcover, Mar 13 2017, translated from Maple *)
CROSSREFS
KEYWORD
nonn,tabl
AUTHOR
Alois P. Heinz, May 28 2016
STATUS
approved