A299039
Number of rooted trees with 2n nodes where each node has at most n children.
Original entry on oeis.org
1, 1, 3, 17, 106, 693, 4690, 32754, 234746, 1719325, 12820920, 97039824, 743680508, 5759507657, 45006692668, 354425763797, 2809931206626, 22409524536076, 179655903886571, 1447023307374888, 11703779855021636, 95020085240320710, 774088021528328920
Offset: 0
a(2) = 3:
o o o
| | / \
o o o o
| / \ |
o o o o
|
o
-
b:= proc(n, i, t, k) option remember; `if`(n=0, 1,
`if`(i<1, 0, add(binomial(b((i-1)$2, k$2)+j-1, j)*
b(n-i*j, i-1, t-j, k), j=0..min(t, n/i))))
end:
a:= n-> `if`(n=0, 1, b(2*n-1$2, n$2)):
seq(a(n), n=0..25);
-
b[n_, i_, t_, k_] := b[n, i, t, k] = If[n == 0, 1, If[i < 1, 0, Sum[ Binomial[b[i - 1, i - 1, k, k] + j - 1, j]*b[n - i*j, i - 1, t - j, k], {j, 0, Min[t, n/i]}]]];
a[n_] := If[n == 0, 1, b[2n - 1, 2n - 1, n, n]];
Table[a[n], {n, 0, 25}] (* Jean-François Alcover, Jun 04 2018, from Maple *)
A000444
Number of partially labeled rooted trees with n nodes (3 of which are labeled).
Original entry on oeis.org
9, 64, 326, 1433, 5799, 22224, 81987, 293987, 1031298, 3555085, 12081775, 40576240, 134919788, 444805274, 1455645411, 4733022100, 15302145060, 49223709597, 157629612076, 502736717207, 1597541346522, 5059625685739, 15975936032821, 50304490599602
Offset: 3
- J. Riordan, An Introduction to Combinatorial Analysis, Wiley, 1958, p. 134.
- N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
- N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
-
b:= proc(n) option remember; if n<=1 then n else add(k*b(k)* s(n-1, k), k=1..n-1)/(n-1) fi end: s:= proc(n,k) option remember; add(b(n+1-j*k), j=1..iquo(n,k)) end: B:= proc(n) option remember; add(b(k)*x^k, k=1..n) end: a:= n-> coeff(series(B(n-2)^3*(9-8*B(n-2)+2*B(n-2)^2)/(1-B(n-2))^5, x=0, n+1), x,n): seq(a(n), n=3..24); # Alois P. Heinz, Aug 21 2008
-
b[n_] := b[n] = If[n <= 1, n, Sum[k*b[k]*s[n-1, k], {k, 1, n-1}]/(n-1)]; s[n_, k_] := s[n, k] = Sum[b[n+1-j*k], {j, 1, Quotient[n, k]}]; B[n_] := B[n] = Sum [b[k]*x^k, {k, 1, n}]; a[n_] := Coefficient[Series[B[n-2]^3*(9 - 8*B[n-2] + 2*B[n-2]^2)/(1 - B[n-2])^5, {x, 0, n+1}], x, n]; Table[a[n], {n, 3, 30}] (* Jean-François Alcover, Mar 10 2014, after Alois P. Heinz *)
A029852
Number of connected functions on n points with a loop of length 3.
Original entry on oeis.org
1, 1, 3, 9, 23, 62, 169, 451, 1217, 3291, 8916, 24243, 66155, 181053, 497134, 1369064, 3780942, 10469573, 29063361, 80867990, 225508124, 630145449, 1764240907, 4948365051, 13902893423, 39124094362, 110265280739, 311208414556, 879523722747, 2488832434859
Offset: 3
-
nn = 20; f[x_] := Sum[a[n] x^n, {n, 0, nn}]; sol =
SolveAlways[
0 == Series[
f[x] - x Product[1/(1 - x^i)^a[i], {i, 1, nn}], {x, 0, nn}],
x]; b = Flatten[Table[a[n], {n, 1, nn}] /. sol]; CoefficientList[
Series[CycleIndex[CyclicGroup[3], s] /.
Table[s[i] -> Sum[b[[k]] x^(k*i), {k, 1, nn}], {i, 1, 3}], {x, 0,
nn}], x] (* Geoffrey Critzer, Aug 08 2013 *)
A029853
Number of connected functions on n points with a loop of length 4.
Original entry on oeis.org
1, 1, 4, 11, 35, 97, 282, 792, 2243, 6275, 17602, 49206, 137713, 385208, 1078667, 3022342, 8478199, 23807190, 66932592, 188394855, 530911452, 1497892857, 4230987944, 11964356354, 33869704270, 95982410945, 272279600817, 773153124315, 2197492308752
Offset: 4
-
nn = 20; f[x_] := Sum[a[n] x^n, {n, 0, nn}]; sol =
SolveAlways[
0 == Series[
f[x] - x Product[1/(1 - x^i)^a[i], {i, 1, nn}], {x, 0, nn}],
x]; b = Flatten[Table[a[n], {n, 1, nn}] /. sol]; CoefficientList[
Series[CycleIndex[CyclicGroup[4], s] /.
Table[s[i] -> Sum[b[[k]] x^(k*i), {k, 1, nn}], {i, 1, 4}], {x, 0,
nn}], x] (* Geoffrey Critzer, Aug 08 2013 *)
A029868
Number of connected functions on n points with a loop of length 5.
Original entry on oeis.org
1, 1, 4, 14, 46, 145, 440, 1315, 3877, 11315, 32792, 94529, 271510, 777764, 2223865, 6350657, 18120730, 51680249, 147359335, 420163711, 1198151432, 3417475326, 9750708533, 27831153091, 79471338455, 227032777454, 648896436944, 1855571389651, 5308837191604
Offset: 5
-
nn = 20; f[x_] := Sum[a[n] x^n, {n, 0, nn}]; sol =
SolveAlways[
0 == Series[
f[x] - x Product[1/(1 - x^i)^a[i], {i, 1, nn}], {x, 0, nn}],
x]; b = Flatten[Table[a[n], {n, 1, nn}] /. sol]; CoefficientList[
Series[CycleIndex[CyclicGroup[5], s] /.
Table[s[i] -> Sum[b[[k]] x^(k*i), {k, 1, nn}], {i, 1, 5}], {x, 0,
nn}], x] (* Geoffrey Critzer, Aug 08 2013 *)
A029869
Number of connected functions on n points with a loop of length 6.
Original entry on oeis.org
1, 1, 5, 18, 63, 206, 671, 2087, 6434, 19472, 58375, 173316, 511452, 1500697, 4386021, 12775455, 37118209, 107621858, 311552351, 900775893, 2601887149, 7510011727, 21664873773, 62473966631, 180104101037, 519126161517, 1496177366884, 4312044894059, 12427896986697
Offset: 6
A181360
Number of forests of rooted trees containing n nodes not counting the root nodes.
Original entry on oeis.org
1, 1, 3, 7, 19, 47, 127, 330, 889, 2378, 6450, 17510, 47907, 131388, 362081, 1000665, 2774857, 7714695, 21505455, 60084062, 168234804, 471977022, 1326558625, 3734804268, 10531738149, 29742332548, 84111212892, 238176473946, 675269414372, 1916715819186
Offset: 0
Trees for example (leaving out the "^0" factors for clarity):
T(0) = 1, T(1) = 1
T(2) = T(1)^1 + T(0)^2 = 2,
T(3) = T(2)^1 + T(1)^1*T(0)^1 + T(0)^3 = 4,
T(4) = T(3)^1 + T(2)^1*T(0)^1 + T(1)^2 + T(1)^1*T(0)^2 +T(0)^4 = 9,
T(5) = T(4)^1 + T(3)^1*T(0)^1 + T(2)^1*T(1)^1 + T(2)^1*T(0)^2 + T(1)^2*T(0)^1 + T(1)^1*T(0)^3 + T(0)^5 = 20.
Forests for example (leaving out the "^0" factors for clarity):
F(2) = T(2)^1 + T(1)^2 = 3,
F(3) = T(3)^1 + T(2)^1*T(1)^1 + T(1)^3 = 7,
F(4) = T(4)^1 + T(3)^1*T(1)^1 + T(2)^2 + T(2)*T(1)^2 + T(1)^4 = 19,
F(5) = T(5)^1 + T(4)^1*T(1)^1 + T(3)^1*T(2)^1 + T(3)^1*T(1)^2 + T(2)^2*T(1)^1 + T(2)^1*T(1)^3 + T(1)^5 = 47.
{Examples of this a^b definition:
2^1 = 2, 2^2 = 3, 2^3 = 4, 2^4 = 5,
3^1 = 3, 3^2 = 6, 3^3 = 10, 3^4 = 15, (triangular numbers)
4^1 = 4, 4^2 = 10, 4^3 = 20, 4^4 = 35, (tetrahedral numbers)
equivalently a^b = (b == 0 ? 1 : (a == 1 || b == 1 ? a : (a * (a+1)^(b-1) / b))) }
Cf.
A093637 (products of partition numbers).
-
(From N. J. A. Sloane, Nov 26 2010) First read 110 terms of A000081 into array b1
M:=100;
t1:=1/mul((1-x*y^i)^b1[i+1],i=2..M):
t2:=series(t1,y,M):
t3:=series(t2,x,M):
a:=(n,k)->coeff(coeff(t3,x,k),y,n);
g:=n->add(a(n-1+i,i),i=1..n-1);
[seq(g(n),n=1..48)];
# second Maple program:
g:= proc(n, i) option remember; `if`(n=0, 1, `if`(i<1, 0,
add(binomial(T(i-1)+j-1, j) *g(n-i*j, i-1), j=0..n/i)))
end:
T:= n-> g(n, n):
b:= proc(n, i) option remember; `if`(n=0, 1, `if`(i<1, 0,
add(binomial(T(i)+j-1, j) *b(n-i*j, i-1), j=0..n/i)))
end:
a:= n-> b(n, n):
seq(a(n), n=0..40); # Alois P. Heinz, Jul 20 2012
# third Maple program:
g:= proc(n) option remember; `if`(n<=1, n, (add(add(d*
g(d), d=numtheory[divisors](j))*g(n-j), j=1..n-1))/(n-1))
end:
a:= proc(n) option remember; `if`(n=0, 1, add(add(d*
g(d+1), d=numtheory[divisors](j))*a(n-j), j=1..n)/n)
end:
seq(a(n), n=0..40); # Alois P. Heinz, Sep 19 2017
-
g[n_, i_] := g[n, i] = If[n==0, 1, If[i<1, 0, Sum[Binomial[T[i-1]+j-1, j]*g[n-i*j, i-1], {j, 0, n/i}]]]; T[n_] := g[n, n]; b[n_, i_] := b[n, i] = If[n==0, 1, If[i<1, 0, Sum[Binomial[T[i]+j-1, j]*b[n-i*j, i-1], {j, 0, n/i}]]]; a[n_] := b[n, n] // FullSimplify; Table[a[n], {n, 1, 40}] (* Jean-François Alcover, Mar 30 2015, after Alois P. Heinz *)
A199812
Number of distinct values taken by w^w^...^w (with n w's and parentheses inserted in all possible ways) where w is the first transfinite ordinal omega.
Original entry on oeis.org
1, 1, 2, 5, 13, 32, 79, 193, 478, 1196, 3037, 7802, 20287, 53259, 141069, 376449, 1011295, 2732453, 7421128, 20247355
Offset: 1
For n=5 there are 14 possible parenthesizations, but only 13 of them produce distinct ordinals: (((w^w)^w)^w)^w < ((w^w)^w)^(w^w) < ((w^w)^(w^w))^w < ((w^(w^w))^w)^w < (w^(w^w))^(w^w) < (w^w)^((w^w)^w) < (w^((w^w)^w))^w < w^(((w^w)^w)^w) < (w^w)^(w^(w^w)) = w^((w^w)^(w^w)) < (w^(w^(w^w)))^w < w^((w^(w^w))^w) < w^(w^((w^w)^w)) < w^(w^(w^(w^w))). So, a(5)=13.
-
(* Slow exhaustive search *)
_ \[Precedes] {} = False;
{} \[Precedes] {} = True;
{a_ \[Diamond] , __} \[Precedes] {b_ \[Diamond] , __} := a \[Precedes] b /; a =!= b;
{a_ \[Diamond] m_, _} \[Precedes] {a_ \[Diamond] n_, _} := m < n /; m != n;
{z_, x___} \[Precedes] {z_, y___} := {x} \[Precedes] {y};
m_ \[CirclePlus] {} := m;
{} \[CirclePlus] n_ := n;
{x___, a_ \[Diamond] m_} \[CirclePlus] {a_ \[Diamond] n_, y___} := {x, a \[Diamond] (m + n), y};
{x___, a_ \[Diamond] m_} \[CirclePlus] z : {b_ \[Diamond] n_, y___} := If[a \[Precedes] b, {x} \[CirclePlus] z, {x, a \[Diamond] m, b \[Diamond] n, y}];
{} \[CircleTimes] _ = {};
_ \[CircleTimes] {} = {};
{a_ \[Diamond] m_, x___} \[CircleTimes] {b_ \[Diamond] n_} := If[b === {}, {a \[Diamond] (m n), x}, {(a \[CirclePlus] b) \[Diamond] n}];
x_ \[CircleTimes] {y_, z__} := x \[CircleTimes] {y} \[CirclePlus] x \[CircleTimes] {z};
f[1] = {{{} \[Diamond] 1}};
f[n_] := f[n] = Union[Flatten[Table[Outer[#1 \[CircleTimes] {#2 \[Diamond] 1} &, f[k], f[n - k], 1], {k, n - 1}], 2]];
Table[Length[f[n]], {n, 1, 17}]
A215982
Number of simple unlabeled graphs on n nodes with exactly 2 connected components that are trees or cycles.
Original entry on oeis.org
1, 1, 3, 5, 10, 17, 33, 62, 127, 267, 587, 1326, 3085, 7326, 17731, 43585, 108563, 273544, 696113, 1787042, 4623125, 12043071, 31565842, 83200763, 220413272, 586625403, 1567930743, 4207181144, 11329835687, 30613313339, 82975300030, 225552632043, 614787508640
Offset: 2
a(5) = 5: .o-o o. .o-o o. .o-o o. .o o-o. .o o-o.
.| | . .| . .|\ . .|\ . .| .
.o-o . .o-o . .o o . .o-o . .o-o .
-
with(numtheory):
b:= proc(n) option remember; local d, j; `if` (n<=1, n,
(add(add(d*b(d), d=divisors(j)) *b(n-j), j=1..n-1))/(n-1))
end:
g:= proc(n) option remember; local k; `if`(n>2, 1, 0)+ b(n)-
(add(b(k)*b(n-k), k=0..n) -`if`(irem(n, 2)=0, b(n/2), 0))/2
end:
p:= proc(n, i, t) option remember; `if`(n p(n, n, 2):
seq(a(n), n=2..40);
-
b[n_] := b[n] = If[n <= 1, n, Sum[Sum[d*b[d], {d, Divisors[j]}]*b[n-j], {j, 1, n-1}]/(n-1)]; g[n_] := g[n] = If[n>2, 1, 0]+b[n]-(Sum [b[k]*b[n-k], {k, 0, n}] - If[Mod[n, 2] == 0, b[n/2], 0])/2; p[n_, i_, t_] := p[n, i, t] = If[nJean-François Alcover, Dec 04 2014, translated from Maple *)
-
from sympy.core.cache import cacheit
from sympy import binomial, divisors
@cacheit
def b(n): return n if n<2 else sum([sum([d*b(d) for d in divisors(j)])*b(n - j) for j in range(1, n)])//(n - 1)
@cacheit
def g(n): return (1 if n>2 else 0) + b(n) - (sum([b(k)*b(n - k) for k in range(n + 1)]) - (b(n//2) if n%2==0 else 0))//2
@cacheit
def p(n, i, t): return 0 if nIndranil Ghosh, Aug 07 2017
A215983
Number of simple unlabeled graphs on n nodes with exactly 3 connected components that are trees or cycles.
Original entry on oeis.org
1, 1, 3, 6, 12, 23, 47, 92, 189, 401, 869, 1949, 4475, 10520, 25183, 61366, 151555, 379164, 958555, 2446746, 6296819, 16326996, 42613240, 111889355, 295372835, 783598713, 2088175182, 5587741350, 15009229137, 40458659246, 109416872688, 296810505298
Offset: 3
a(5) = 3: .o o-o. .o o-o. .o o o.
. |/ . . | . .| | .
.o o . .o o . .o o .
-
with(numtheory):
b:= proc(n) option remember; local d, j; `if`(n<=1, n,
(add(add(d*b(d), d=divisors(j)) *b(n-j), j=1..n-1))/(n-1))
end:
g:= proc(n) option remember; local k; `if`(n>2, 1, 0)+ b(n)-
(add(b(k)*b(n-k), k=0..n) -`if`(irem(n, 2)=0, b(n/2), 0))/2
end:
p:= proc(n, i, t) option remember; `if`(n p(n, n, 3):
seq(a(n), n=3..40);
-
b[n_] := b[n] = If[n <= 1, n, Sum[Sum[d*b[d], {d, Divisors[j]}]*b[n - j], {j, 1, n - 1}]/(n - 1)];
g[n_] := g[n] = If[n > 2, 1, 0] + b[n] - (Sum[b[k]*b[n - k], {k, 0, n}] - If[Mod[n, 2] == 0, b[n/2], 0])/2;
p[n_, i_, t_] := p[n, i, t] = If[n < t, 0, If[n == t, 1, If[Min[i, t] < 1, 0, Sum[Binomial[g[i] + j - 1, j]*p[n - i*j, i - 1, t - j], {j, 0, Min[n/i, t]}]]]];
a[n_] := p[n, n, 3];
a /@ Range[3, 40] (* Jean-François Alcover, Dec 18 2020, after Alois P. Heinz *)
Comments