OFFSET
0,6
COMMENTS
A(n,k) is also the number of ways of placing n labeled balls into indistinguishable boxes, where in each filled box k balls are seen at the top. E.g. A(3,1)=10:
|1.| |2.| |3.| |1|2| |1|2| |1|3| |1|3| |2|3| |2|3| |1|2|3|
|23| |13| |12| |3|.| |.|3| |2|.| |.|2| |1|.| |.|1| |.|.|.|
+--+ +--+ +--+ +-+-+ +-+-+ +-+-+ +-+-+ +-+-+ +-+-+ +-+-+-+
LINKS
Alois P. Heinz, Antidiagonals n = 0..140, flattened
N. J. A. Sloane, Transforms
FORMULA
A(0,k) = 1 and A(n,k) = Sum_{i=0..n-1} binomial(n-1,i) * binomial(i+1,k) * A(n-1-i,k) for n > 0. - Seiichi Manyama, Sep 28 2017
EXAMPLE
Square array A(n,k) begins:
1, 1, 1, 1, 1, 1, ...
1, 1, 0, 0, 0, 0, ...
2, 3, 1, 0, 0, 0, ...
5, 10, 3, 1, 0, 0, ...
15, 41, 9, 4, 1, 0, ...
52, 196, 40, 10, 5, 1, ...
MAPLE
exptr:= proc(p) local g; g:=
proc(n) option remember; `if`(n=0, 1,
add(binomial(n-1, j-1) *p(j) *g(n-j), j=1..n))
end: end:
A:= (n, k)-> exptr(i-> binomial(i, k))(n):
seq(seq(A(n, d-n), n=0..d), d=0..12);
MATHEMATICA
Exptr[p_] := Module[{g}, g[n_] := g[n] = If[n == 0, 1, Sum[Binomial[n-1, j-1] *p[j]*g[n-j], {j, 1, n}]]; g]; A[n_, k_] := Exptr[Function[i, Binomial[i, k]]][n]; Table[Table[A[n, d-n], {n, 0, d}], {d, 0, 12}] // Flatten (* Jean-François Alcover, Jan 15 2014, translated from Maple *)
PROG
(Ruby)
def ncr(n, r)
return 1 if r == 0
(n - r + 1..n).inject(:*) / (1..r).inject(:*)
end
def A(k, n)
ary = [1]
(1..n).each{|i| ary << (0..i - 1).inject(0){|s, j| s + ncr(i - 1, j) * ncr(j + 1, k) * ary[i - 1 - j]}}
ary
end
def A145460(n)
a = []
(0..n).each{|i| a << A(i, n - i)}
ary = []
(0..n).each{|i|
(0..i).each{|j|
ary << a[i - j][j]
}
}
ary
end
p A145460(20) # Seiichi Manyama, Sep 28 2017
CROSSREFS
KEYWORD
nonn,tabl
AUTHOR
Alois P. Heinz, Oct 10 2008
STATUS
approved