A005199
a(n) = Sum_t t*F(n,t), where F(n,t) is the number of forests with n (unlabeled) nodes and exactly t trees, all of which are planted (that is, rooted trees in which the root has degree 1).
Original entry on oeis.org
0, 1, 1, 4, 6, 18, 35, 93, 214, 549, 1362, 3534, 9102, 23951, 63192, 168561, 451764, 1219290, 3305783, 9008027, 24643538, 67681372, 186504925, 515566016, 1429246490, 3972598378, 11068477743, 30908170493, 86488245455, 242481159915, 681048784377, 1916051725977, 5399062619966
Offset: 1
- N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
-
g(m) = {my(f); if(m==0, return(1)); f = vector(m+1); f[1]=1;
for(j=1, m, f[j+1]=1/j * sum(k=1, j, sumdiv(k,d, d * f[d]) * f[j-k+1])); f[m+1] };
global(max_n = 130); A000081 = vector(max_n, n, g(n-1));
F(n,t)={my(s=0, D, c, P_1); forpart(P_1 = n, D = Set(P_1); c = vector(#D);
for(k=1, #D, c[k] = #select(x->x == D[k], Vec(P_1)));
s += prod(k=1, #D, binomial( A000081[D[k]-1] + c[k] - 1, c[k]) )
,[2,n],[t,t]); s};
seq(n) = sum(t=1,n\2, t*F(n,t) ); \\ Washington Bomfim, Jul 08 2020
A029855
Number of rooted trees where root has degree 4.
Original entry on oeis.org
1, 1, 3, 7, 19, 46, 124, 320, 858, 2282, 6161, 16647, 45352, 123861, 340000, 936098, 2586518, 7166394, 19911638, 55456892, 154814055, 433081632, 1213901668, 3408659401, 9587879987, 27011564035, 76212078500
Offset: 5
- F. Harary and E. M. Palmer, Graphical Enumeration, Academic Press, NY, 1973, p. 53.
-
Needs["Combinatorica`"];
nn=30;s[n_,k_]:=s[n,k]=a[n+1-k]+If[n<2k,0,s[n-k,k]];a[1]=1;a[n_]:=a[n]=Sum[a[i]s[n-1,i]i,{i,1,n-1}]/(n-1);rt=Table[a[i],{i,1,nn}];Drop[Take[CoefficientList[CycleIndex[SymmetricGroup[4],s]/.Table[s[j]->Table[Sum[rt[[i]]x^(k*i),{i,1,nn}],{k,1,nn}][[j]],{j,1,nn}],x],nn],4] (* Geoffrey Critzer, Oct 14 2012, after code by Robert A. Russell in A000081 *)
-
max_n = 200; f=vector(max_n); \\ f[n] = A000081[n], n=1..max_n
sum2(k) = {local(s); s=0; fordiv(k, d, s += d*f[d]); return(s)};
Init_f()={f[1]=1;
for(n =1, max_n -2, s=0; for(k=1, n, s+=sum2(k)*f[n-k+1]); f[n+1]=s/n)};
S=0; P=[0,1,1,1,1,0];
visit4() = {i = 3; k = 2; p = P[2]; Pr = 1;
while(1, while(P[i]==p, i++);c=i-k;Pr*=binomial(f[P[k]]+c-1, c);
if(P[i] == 0, S += Pr; return); p = P[i]; k = i; i++)};
\\ F. Ruskey partition generator
Part(n, k, s, t) = { P[t] = s;
if((k == 1) || (n == k), visit4(), L = max(1, ceil((n - s)/(k - 1)));
for(j = L, min(s, n-s-k+2), Part(n-s, k-1, j, t+1))); P[t] = 1;};
\\
a(n) = {S=0; n--; Part(2*n,4+1,n,1); return(S)}
Init_f(); for(n=5, max_n, print(n, " ", a(n))) \\ b-file format
\\ # Washington Bomfim, Jul 10 2012
A105819
Triangle of the numbers of different forests of m rooted trees of smallest order 2, i.e., without isolated vertices, on N labeled nodes.
Original entry on oeis.org
0, 2, 0, 9, 0, 0, 64, 12, 0, 0, 625, 180, 0, 0, 0, 7776, 2730, 120, 0, 0, 0, 117649, 46410, 3780, 0, 0, 0, 0, 2097152, 893816, 99120, 1680, 0, 0, 0, 0, 43046721, 19389384, 2600640, 90720, 0, 0, 0, 0, 0, 1000000000, 469532790, 71734320, 3654000, 30240, 0
Offset: 1
a(8) = 12 because 4 vertices can be partitioned in two trees only in one way: both trees receiving 2 vertices. Two trees on 2 vertices can be labeled in binomial(4,2) ways and to each one of the 2*binomial(4,2) = 12 possibilities there are more 2 possible trees of order 2 in a forest. But since we have 2 trees of the same order, i.e., 2, we must divide 2*binomial(4,2)*2 by 2!.
Triangle T(n,k) begins:
: 0;
: 2, 0;
: 9, 0, 0;
: 64, 12, 0, 0;
: 625, 180, 0, 0, 0;
: 7776, 2730, 120, 0, 0, 0;
: 117649, 46410, 3780, 0, 0, 0, 0;
: 2097152, 893816, 99120, 1680, 0, 0, 0, 0;
-
# The function BellMatrix is defined in A264428.
# Adds (1,0,0,0, ..) as column 0.
BellMatrix(n -> `if`(n=0,0,(n+1)^n), 9); # Peter Luschny, Jan 27 2016
# second Maple program:
b:= proc(n) option remember; expand(`if`(n=0, 1, add(
binomial(n-1, j-1)*j^(j-1)*x*b(n-j), j=2..n)))
end:
T:= (n, k)-> coeff(b(n), x, k):
seq(seq(T(n, k), k=1..n), n=1..12); # Alois P. Heinz, Aug 13 2017
-
BellMatrix[f_, len_] := With[{t = Array[f, len, 0]}, Table[BellY[n, k, t], {n, 0, len - 1}, {k, 0, len - 1}]];
rows = 12;
B = BellMatrix[Function[n, If[n == 0, 0, (n+1)^n]], rows];
Table[B[[n, k]], {n, 2, rows}, {k, 2, n}] // Flatten (* Jean-François Alcover, Jun 28 2018, after Peter Luschny *)
A336087
Triangle read by rows: T(n, k) is the number of forests with n (unlabeled) nodes and k planted trees.
Original entry on oeis.org
0, 1, 0, 1, 0, 0, 2, 1, 0, 0, 4, 1, 0, 0, 0, 9, 3, 1, 0, 0, 0, 20, 6, 1, 0, 0, 0, 0, 48, 16, 3, 1, 0, 0, 0, 0, 115, 37, 7, 1, 0, 0, 0, 0, 0, 286, 96, 18, 3, 1, 0, 0, 0, 0, 0, 719, 239, 44, 7, 1, 0, 0, 0, 0, 0, 0, 1842, 622, 117, 19, 3, 1, 0, 0, 0, 0, 0, 0, 4766, 1607, 299, 46, 7, 1, 0, 0, 0, 0, 0, 0, 0, 12486, 4235, 793, 124
Offset: 1
Triangle T(n,k)
n\k 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
1 0;
2 1, 0;
3 1, 0, 0;
4 2, 1, 0, 0;
5 4, 1, 0, 0, 0;
6 9, 3, 1, 0, 0, 0;
7 20, 6, 1, 0, 0, 0, 0;
8 48, 16, 3, 1, 0, 0, 0, 0;
9 115, 37, 7, 1, 0, 0, 0, 0, 0;
10 286, 96, 18, 3, 1, 0, 0, 0, 0, 0;
11 719, 239, 44, 7, 1, 0, 0, 0, 0, 0, 0;
12 1842, 622, 117, 19, 3, 1, 0, 0, 0, 0, 0, 0;
13 4766, 1607, 299, 46, 7, 1, 0, 0, 0, 0, 0, 0, 0;
14 12486, 4235, 793, 124, 19, 3, 1, 0, 0, 0, 0, 0, 0, 0;
15 32973, 11185, 2095, 320, 47, 7, 1, 0, 0, 0, 0, 0, 0, 0, 0;
...
n\k 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
A005199(6) = Sum_{k=1..6}( k * T(6,k) ) = 1*9 + 2*3 +3*1 = 18.
-
g(m) = {my(f); if(m==0, return(1)); f = vector(m+1); f[1]=1;
for(j=1, m, f[j+1]=1/j * sum(k=1, j, sumdiv(k,d, d * f[d]) * f[j-k+1])); f[m+1] };
global(max_n = 130); A000081 = vector(max_n, n, g(n-1));
F(n,t)={my(s=0, D, c, P_1); if(n==1,return(0)); forpart(P_1 = n, D = Set(P_1); c = vector(#D); for(k=1, #D, c[k] = #select(x->x == D[k], Vec(P_1)));
s += prod(k=1, #D, binomial( A000081[D[k]-1] + c[k] - 1, c[k])),[2,n],[t,t]); s};
A105786
Triangle of the numbers of different forests of m unrooted trees of smallest order 2, i.e., without isolated vertices, on N labeled nodes.
Original entry on oeis.org
0, 1, 0, 3, 0, 0, 16, 3, 0, 0, 125, 30, 0, 0, 0, 1296, 330, 15, 0, 0, 0, 16807, 4305, 315, 0, 0, 0, 0, 262144, 66248, 5880, 105, 0, 0, 0, 0, 4782969, 1183644, 115290, 3780, 0, 0, 0, 0, 0, 100000000, 24170310, 2467080, 107100, 945, 0, 0, 0, 0, 0, 2357947691, 556409535
Offset: 1
a(8) = 3 because 4 vertices can be partitioned in two trees only in one way: both trees receiving 2 vertices. The unique tree on 2 vertices can be labeled in binomial(4,2) ways and to each one of the binomial(4,2) = 6 possibilities there is just another tree of order 2 in a forest. But since we have 2 trees of the same order, i.e., 2, we must divide binomial(4,2) by 2!.
-
# The function BellMatrix is defined in A264428.
# Adds (1,0,0,0, ..) as column 0.
BellMatrix(n -> `if`(n=0,0,(n+1)^(n-1)), 9); # Peter Luschny, Jan 27 2016
-
BellMatrix[f_, len_] := With[{t = Array[f, len, 0]}, Table[BellY[n, k, t], {n, 0, len - 1}, {k, 0, len - 1}]];
B = BellMatrix[Function[n, If[n == 0, 0, (n+1)^(n-1)]], rows = 12];
Table[B[[n, k]], {n, 2, rows}, {k, 2, n}] // Flatten (* Jean-François Alcover, Jun 28 2018, after Peter Luschny *)
A106235
Triangle of the numbers of different forests of m rooted trees of smallest order 2, i.e., without isolated vertices.
Original entry on oeis.org
0, 1, 0, 2, 0, 0, 4, 1, 0, 0, 9, 2, 0, 0, 0, 20, 7, 1, 0, 0, 0, 48, 17, 2, 0, 0, 0, 0, 115, 48, 7, 1, 0, 0, 0, 0, 286, 124, 21, 2, 0, 0, 0, 0, 0, 719, 336, 60, 7, 1, 0, 0, 0, 0, 0, 1842, 888, 171, 21, 2, 0, 0, 0, 0, 0, 0, 4766, 2393, 488, 65, 7, 1, 0, 0, 0, 0, 0, 0
Offset: 1
a(12)=2 because 5 nodes can be partitioned in two trees only in a way: one tree gets 3 nodes and the other tree gets 2. Since A000081(3) = 2 and A000081(2)=1, there are two forests.
Triangle T(n,k) begins:
0;
1, 0;
2, 0, 0;
4, 1, 0, 0;
9, 2, 0, 0, 0;
20, 7, 1, 0, 0, 0;
48, 17, 2, 0, 0, 0, 0;
115, 48, 7, 1, 0, 0, 0, 0;
286, 124, 21, 2, 0, 0, 0, 0, 0;
719, 336, 60, 7, 1, 0, 0, 0, 0, 0;
-
with(numtheory):
g:= proc(n) option remember; `if`(n<=1, n, (add(add(
d*g(d), d=divisors(j))*g(n-j), j=1..n-1))/(n-1))
end:
b:= proc(n, i) option remember; `if`(n=0, 1, `if`(i=1,
0, expand(add(x^j*b(n-i*j, i-1)*
binomial(g(i)+j-1, j), j=0..n/i))))
end:
T:= n-> (p-> seq(coeff(p, x, i), i=1..n))(b(n$2)):
seq(T(n), n=1..14); # Alois P. Heinz, Jun 25 2014
-
g[n_] := g[n] = If[n <= 1, n, (Sum[Sum[d*g[d], {d, Divisors[j]}]*g[n-j], {j, 1, n-1}])/(n-1)]; b[n_, i_] := b[n, i] = If[n == 0, 1, If[i == 1, 0, Expand[Sum[x^j*b[n-i*j, i-1]*Binomial[g[i]+j-1, j], {j, 0, n/i}]]]]; T[n_] := Function[p, Table[Coefficient[p, x, i], {i, 1, n}]][b[n, n]]; Table[T[n], {n, 1, 14}] // Flatten (* Jean-François Alcover, Nov 05 2015, after Alois P. Heinz *)
Comments