login
Triangle read by rows: T(n,k) = number of forests of labeled rooted trees with n nodes and height at most k (n>=1, 0<=k<=n-1).
7

%I #33 Apr 26 2021 11:19:44

%S 1,1,3,1,10,16,1,41,101,125,1,196,756,1176,1296,1,1057,6607,12847,

%T 16087,16807,1,6322,65794,160504,229384,257104,262144,1,41393,733833,

%U 2261289,3687609,4480569,4742649,4782969,1,293608,9046648,35464816,66025360,87238720,96915520,99637120,100000000

%N Triangle read by rows: T(n,k) = number of forests of labeled rooted trees with n nodes and height at most k (n>=1, 0<=k<=n-1).

%H Alois P. Heinz, <a href="/A210725/b210725.txt">Rows n = 1..141, flattened</a>

%H J. Riordan, <a href="http://dx.doi.org/10.1016/S0021-9800(68)80033-X">Forests of labeled trees</a>, J. Combin. Theory, 5 (1968), 90-103.

%e Triangle begins:

%e 1;

%e 1, 3;

%e 1, 10, 16;

%e 1, 41, 101, 125;

%e 1, 196, 756, 1176, 1296;

%e 1, 1057, 6607, 12847, 16087, 16807;

%e ...

%p f:= proc(k) f(k):= `if`(k<0, 1, exp(x*f(k-1))) end:

%p T:= (n, k)-> coeff(series(f(k), x, n+1), x, n) *n!:

%p seq(seq(T(n, k), k=0..n-1), n=1..9); # _Alois P. Heinz_, May 30 2012

%p # second Maple program:

%p T:= proc(n, h) option remember; `if`(min(n, h)=0, 1, add(

%p binomial(n-1, j-1)*j*T(j-1, h-1)*T(n-j, h), j=1..n))

%p end:

%p seq(seq(T(n, k), k=0..n-1), n=1..10); # _Alois P. Heinz_, Aug 21 2017

%t f[_?Negative] = 1; f[k_] := Exp[x*f[k-1]]; t[n_, k_] := Coefficient[Series[f[k], {x, 0, n+1}], x, n]*n!; Table[Table[t[n, k], {k, 0, n-1}], {n, 1, 9}] // Flatten (* _Jean-François Alcover_, Oct 30 2013, after Maple *)

%o (Python)

%o from sympy.core.cache import cacheit

%o from sympy import binomial

%o @cacheit

%o def T(n, h): return 1 if min(n, h)==0 else sum([binomial(n - 1, j - 1)*j*T(j - 1, h - 1)*T(n - j, h) for j in range(1, n + 1)])

%o for n in range(1, 11): print([T(n, k) for k in range(n)]) # _Indranil Ghosh_, Aug 21 2017, after second Maple code

%Y Diagonals include A000248, A000949, A000950, A000951, A000272.

%K nonn,tabl

%O 1,3

%A _N. J. A. Sloane_, May 09 2012