A005197
a(n) = Sum_t t*F(n,t), where F(n,t) (see A033185) is the number of rooted forests with n (unlabeled) nodes and exactly t rooted trees.
Original entry on oeis.org
1, 3, 7, 17, 39, 96, 232, 583, 1474, 3797, 9864, 25947, 68738, 183612, 493471, 1334143, 3624800, 9893860, 27113492, 74577187, 205806860, 569678759, 1581243203, 4400193551, 12273287277, 34307646762, 96093291818, 269654004899, 758014312091, 2134300171031
Offset: 1
- N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
-
with(numtheory):
t:= proc(n) option remember; local d, j; `if`(n<=1, n,
(add(add(d*t(d), d=divisors(j))*t(n-j), j=1..n-1))/(n-1))
end:
b:= proc(n, i, p) option remember; `if`(p>n, 0, `if`(n=0, 1,
`if`(min(i, p)<1, 0, add(b(n-i*j, i-1, p-j) *
binomial(t(i)+j-1, j), j=0..min(n/i, p)))))
end:
a:= a-> add(k*b(n, n, k), k=1..n):
seq(a(n), n=1..40); # Alois P. Heinz, Aug 20 2012
-
t[1] = 1; t[n_] := t[n] = Module[{d, j}, Sum[Sum[d*t[d], {d, Divisors[j]}]*t[n-j], {j, 1, n-1}]/(n-1)]; b[1, 1, 1] = 1; b[n_, i_, p_] := b[n, i, p] = If[p>n, 0, If[n == 0, 1, If[Min[i, p]<1, 0, Sum[b[n-i*j, i-1, p-j]*Binomial[t[i]+j-1, j], {j, 0, Min[n/i, p]}]]]]; a[n_] := Sum[k*b[n, n, k], {k, 1, n}]; Table[a[n] // FullSimplify, {n, 1, 30}] (* Jean-François Alcover, Mar 13 2014, after Alois P. Heinz *)
A000081
Number of unlabeled rooted trees with n nodes (or connected functions with a fixed point).
Original entry on oeis.org
0, 1, 1, 2, 4, 9, 20, 48, 115, 286, 719, 1842, 4766, 12486, 32973, 87811, 235381, 634847, 1721159, 4688676, 12826228, 35221832, 97055181, 268282855, 743724984, 2067174645, 5759636510, 16083734329, 45007066269, 126186554308, 354426847597, 997171512998
Offset: 0
G.f. = x + x^2 + 2*x^3 + 4*x^4 + 9*x^5 + 20*x^6 + 48*x^7 + 115*x^8 + ...
From _Joerg Arndt_, Jun 29 2014: (Start)
The a(6) = 20 trees with 6 nodes have the following level sequences (with level of root = 0) and parenthesis words:
01: [ 0 1 2 3 4 5 ] (((((())))))
02: [ 0 1 2 3 4 4 ] ((((()()))))
03: [ 0 1 2 3 4 3 ] ((((())())))
04: [ 0 1 2 3 4 2 ] ((((()))()))
05: [ 0 1 2 3 4 1 ] ((((())))())
06: [ 0 1 2 3 3 3 ] (((()()())))
07: [ 0 1 2 3 3 2 ] (((()())()))
08: [ 0 1 2 3 3 1 ] (((()()))())
09: [ 0 1 2 3 2 3 ] (((())(())))
10: [ 0 1 2 3 2 2 ] (((())()()))
11: [ 0 1 2 3 2 1 ] (((())())())
12: [ 0 1 2 3 1 2 ] (((()))(()))
13: [ 0 1 2 3 1 1 ] (((()))()())
14: [ 0 1 2 2 2 2 ] ((()()()()))
15: [ 0 1 2 2 2 1 ] ((()()())())
16: [ 0 1 2 2 1 2 ] ((()())(()))
17: [ 0 1 2 2 1 1 ] ((()())()())
18: [ 0 1 2 1 2 1 ] ((())(())())
19: [ 0 1 2 1 1 1 ] ((())()()())
20: [ 0 1 1 1 1 1 ] (()()()()())
(End)
- F. Bergeron, G. Labelle and P. Leroux, Combinatorial Species and Tree-Like Structures, Camb. 1998, p. 279.
- N. L. Biggs et al., Graph Theory 1736-1936, Oxford, 1976, pp. 42, 49.
- Miklos Bona, editor, Handbook of Enumerative Combinatorics, CRC Press, 2015, pages 305, 998.
- A. Cayley, On the analytical forms called trees, with application to the theory of chemical combinations, Reports British Assoc. Advance. Sci. 45 (1875), 257-305 = Math. Papers, Vol. 9, 427-460 (see p. 451).
- J. L. Gross and J. Yellen, eds., Handbook of Graph Theory, CRC Press, 2004; p. 526.
- F. Harary, Graph Theory. Addison-Wesley, Reading, MA, 1969, p. 232.
- F. Harary and E. M. Palmer, Graphical Enumeration, Academic Press, NY, 1973, pp. 54 and 244.
- Alexander S. Karpenko, Łukasiewicz Logics and Prime Numbers, Luniver Press, Beckington, 2006, p. 82.
- D. E. Knuth, The Art of Computer Programming, Vol. 1: Fundamental Algorithms, 3d Ed. 1997, pp. 386-388.
- D. E. Knuth, The Art of Computer Programming, vol. 1, 3rd ed., Fundamental Algorithms, p. 395, ex. 2.
- D. E. Knuth, TAOCP, Vol. 4, Section 7.2.1.6.
- G. Polya and R. C. Read, Combinatorial Enumeration of Groups, Graphs and Chemical Compounds, Springer-Verlag, 1987, p. 63.
- R. C. Read and R. J. Wilson, An Atlas of Graphs, Oxford, 1998. [Comment from Neven Juric: Page 64 incorrectly gives a(21)=35224832.]
- J. Riordan, An Introduction to Combinatorial Analysis, Wiley, 1958, p. 138.
- 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).
- Robert G. Wilson v, Table of n, a(n) for n = 0..1000 (first 201 terms from N. J. A. Sloane)
- M. J. H. Al-Kaabi, D. Manchon and F. Patras, Monomial bases and pre-Lie structure for free Lie algebras, arXiv:1708.08312 [math.RA], 2017, See p. 5.
- Lluís Alemany-Puig and Ramon Ferrer-i-Cancho, Linear-time calculation of the expected sum of edge lengths in random projective linearizations of trees, arXiv:2107.03277 [cs.CL], 2021.
- Winfried Auzinger, H. Hofstaetter and O. Koch, Symbolic Manipulation of Flows of Nonlinear Evolution Equations, with Application in the Analysis of Split-Step Time Integrators, arXiv preprint arXiv:1605.00453 [math.NA], 2016.
- Roland Bacher, Counting invertible Schrodinger Operators over Finite Fields for Trees Cycles and Complete Graphs, preprint, 2015.
- David Broadhurst, Resurgent Integer Sequences, Rutgers Experimental Math Seminar, Feb 06 2025; Slides.
- A. Cayley, On the analytical forms called trees, Amer. J. Math., 4 (1881), 266-268.
- Bartomeu Fiol, Jairo Martínez-Montoya and Alan Rios Fukelman, The planar limit of N=2 superconformal field theories, arXiv:2003.02879 [hep-th], 2020.
- P. Flajolet, S. Gerhold and B. Salvy, On the non-holonomic character of logarithms, powers and the n-th prime function, arXiv:math/0501379 [math.CO], 2005.
- P. Flajolet and R. Sedgewick, Analytic Combinatorics, 2009; see page 71.
- Loïc Foissy, Algebraic structures on typed decorated rooted trees, arXiv:1811.07572 [math.RA], 2018.
- A. Genitrini, Full asymptotic expansion for Polya structures, arXiv:1605.00837 [math.CO], May 03 2016, p. 6.
- Ira M. Gessel, Good Will Hunting's Problem: Counting Homeomorphically Irreducible Trees, arXiv:2305.03157 [math.CO], 2023.
- Bernhard Gittenberger, Emma Yu Jin and Michael Wallner, On the shape of random Pólya structures, arXiv|1707.02144 [math.CO], 2017-2018; Discrete Math., 341 (2018), 896-911.
- F. Goebel, On a 1-1-correspondence between rooted trees and natural numbers, J. Combin. Theory, B 29 (1980), 141-143.
- F. Goebel and R. P. Nederpelt, The number of numerical outcomes of iterated powers, Amer. Math. Monthly, 80 (1971), 1097-1103.
- Mika Göös and Jukka Suomela, Locally checkable proofs in distributed computing Theory Comput. 12, Paper No. 19, 33 p. (2016).
- Vsevolod Gubarev, Rota-Baxter operators on a sum of fields, arXiv:1811.08219 [math.RA], 2018.
- Ivan Gutman and Yeong-Nan Yeh, Deducing properties of trees from their Matula numbers, Publications de l'Institut Mathématique (Beograd) (N.S.), Vol. 53(67), pp. 17--22 (1993).
- R. K. Guy, Letter to N. J. A. Sloane, 1988-04-12 (annotated scanned copy)
- R. K. Guy and J. L. Selfridge, The nesting and roosting habits of the laddered parenthesis (annotated cached copy)
- R. K. Guy and J. L. Selfridge, The nesting and roosting habits of the laddered parenthesis, Amer. Math. Monthly 80 (8) (1973), 868-876.
- F. Harary and G. Prins, The number of homeomorphically irreducible trees, and other species, Acta Math. 101 (1-2) (1959) 141-161, see page 146.
- F. Harary and R. W. Robinson, The number of achiral trees, Jnl. Reine Angewandte Mathematik 278 (1975), 322-335. (Annotated scanned copy)
- R. Harary and R. W. Robinson, Isomorphic factorizations VIII: bisectable trees, Combinatorica 4 (2) (1984) 169-179, eq. (4.3)
- INRIA Algorithms Project, Encyclopedia of Combinatorial Structures 57
- E. Kalinowski and W. Gluza, Evaluation of High Order Terms for the Hubbard Model in the Strong-Coupling Limit, arXiv:1106.4938 [cond-mat.str-el], 2011 (Physical Review B 85, 045105, Jan 2012).
- P. Leroux and B. Miloudi, Généralisations de la formule d'Otter, Ann. Sci. Math. Québec, Vol. 16, No. 1, pp. 53-80, 1992. (Annotated scanned copy)
- Dominique Manchon, On the mathematics of rooted trees, Université Clermont-Auvergne (France, 2019).
- Math Overflow, Discussion
- R. J. Mathar, Topologically Distinct Sets of Non-intersecting Circles in the Plane, arXiv:1603.00077 [math.CO], 2016.
- D. Matula, A natural rooted tree enumeration by prime factorization, SIAM Rev. 10 (1968) 273.
- R. I. McLachlan, K. Modin, H. Munthe-Kaas and O. Verdier, What are Butcher series, really? The story of rooted trees and numerical methods for evolution equations, arXiv preprint arXiv:1512.00906 [math.NA], 2015.
- Igor Pak, Complexity problems in enumerative combinatorics, arXiv:1803.06636 [math.CO], 2018.
- E. M. Palmer and A. J. Schwenk, On the number of trees in a random forest, J. Combin. Theory, B 27 (1979), 109-121.
- N. Pippenger, Enumeration of equicolorable trees, SIAM J. Discrete Math., 14 (2001), 93-115.
- G. Polya, Kombinatorische Anzahlbestimmungen für Gruppen, Graphen und chemische Verbindungen, Acta Mathematica, vol. 68, no. 1, pp. 145-254, (1937).
- R. W. Robinson, Letter to N. J. A. Sloane, Jul 29 1980
- Frank Ruskey, Information on Rooted Trees
- A. J. Schwenk, Letter to N. J. A. Sloane, Aug 1972
- N. J. A. Sloane, Illustration of initial terms
- N. J. A. Sloane, Bijection between rooted trees and arrangements of circles
- N. J. A. Sloane, "A Handbook of Integer Sequences" Fifty Years Later, arXiv:2301.03149 [math.NT], 2023, p. 1.
- Peter Steinbach, Field Guide to Simple Graphs, Volume 1, Part 17 (For Volumes 1, 2, 3, 4 of this book see A000088, A008406, A000055, A000664, respectively.)
- Peter Steinbach, Field Guide to Simple Graphs, Volume 3, Part 10 (For Volumes 1, 2, 3, 4 of this book see A000088, A008406, A000055, A000664, respectively.)
- Peter Steinbach, Field Guide to Simple Graphs, Volume 3, Part 12 (For Volumes 1, 2, 3, 4 of this book see A000088, A008406, A000055, A000664, respectively.)
- Roger Vogeler, Six Circles, 2015 (illustration for a(7) as the number of arrangements of six circles).
- Eric Weisstein's World of Mathematics, Rooted Tree
- Eric Weisstein's World of Mathematics, Planted Tree
- G. Xiao, Contfrac
- Index entries for "core" sequences
- Index entries for sequences related to rooted trees
- Index entries for sequences related to trees
- Index entries for sequences related to parenthesizing
- Index entries for continued fractions for constants
Cf.
A000041 (partitions),
A000055 (unrooted trees),
A000169,
A001858,
A005200,
A027750,
A051491,
A051492,
A093637,
A187770,
A199812,
A255170,
A087803 (partial sums).
-
import Data.List (genericIndex)
a000081 = genericIndex a000081_list
a000081_list = 0 : 1 : f 1 [1,0] where
f x ys = y : f (x + 1) (y : ys) where
y = sum (zipWith (*) (map h [1..x]) ys) `div` x
h = sum . map (\d -> d * a000081 d) . a027750_row
-- Reinhard Zumkeller, Jun 17 2013
-
N := 30; P := PowerSeriesRing(Rationals(),N+1); f := func< A | x*&*[Exp(Evaluate(A,x^k)/k) : k in [1..N]]>; G := x; for i in [1..N] do G := f(G); end for; G000081 := G; A000081 := [0] cat Eltseq(G); // Geoff Bailey (geoff(AT)maths.usyd.edu.au), Nov 30 2009
-
N := 30: a := [1,1]; for n from 3 to N do x*mul( (1-x^i)^(-a[i]), i=1..n-1); series(%,x,n+1); b := coeff(%,x,n); a := [op(a),b]; od: a; A000081 := proc(n) if n=0 then 1 else a[n]; fi; end; G000081 := series(add(a[i]*x^i,i=1..N),x,N+2); # also used in A000055
spec := [ T, {T=Prod(Z,Set(T))} ]; A000081 := n-> combstruct[count](spec,size=n); [seq(combstruct[count](spec,size=n), n=0..40)];
# a much more efficient method for computing the result with Maple. It uses two procedures:
a := proc(n) local k; a(n) := add(k*a(k)*s(n-1,k), k=1..n-1)/(n-1) end proc:
a(0) := 0: a(1) := 1: s := proc(n,k) local j; s(n,k) := add(a(n+1-j*k), j=1..iquo(n,k)); # Joe Riel (joer(AT)san.rr.com), Jun 23 2008
# even more efficient, uses the Euler transform:
with(numtheory): a:= proc(n) option remember; local d, j; `if`(n<=1, n, (add(add(d*a(d), d=divisors(j)) *a(n-j), j=1..n-1))/ (n-1)) end:
seq(a(n), n=0..50); # Alois P. Heinz, Sep 06 2008
-
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); Table[ a[ i ], {i, 1, 30} ] (* Robert A. Russell *)
a[n_] := a[n] = If[n <= 1, n, Sum[Sum[d*a[d], {d, Divisors[j]}]*a[n-j], {j, 1, n-1}]/(n-1)]; Table[a[n], {n, 0, 30}] (* Jean-François Alcover, Feb 17 2014, after Alois P. Heinz *)
a[n_] := a[n] = If[n <= 1, n, Sum[a[n - j] DivisorSum[j, # a[#] &], {j, n - 1}]/(n - 1)]; Table[a[n], {n, 0, 30}] (* Jan Mangaldan, May 07 2014, after Alois P. Heinz *)
(* first do *) << NumericalDifferentialEquationAnalysis`; (* then *)
ButcherTreeCount[30] (* v8 onward Robert G. Wilson v, Sep 16 2014 *)
a[n:0|1] := n; a[n_] := a[n] = Sum[m a[m] a[n-k*m], {m, n-1}, {k, (n-1)/m}]/(n-1); Table[a[n], {n, 0, 30}] (* Vladimir Reshetnikov, Nov 06 2015 *)
terms = 31; A[] = 0; Do[A[x] = x*Exp[Sum[A[x^k]/k, {k, 1, j}]] + O[x]^j // Normal, {j, 1, terms}]; CoefficientList[A[x], x] (* Jean-François Alcover, Jan 11 2018 *)
-
g(m):= block([si,v],s:0,v:divisors(m), for si in v do (s:s+r(m/si)/si),s);
r(n):=if n=1 then 1 else sum(Co(n-1,k)/k!,k,1,n-1);
Co(n,k):=if k=1 then g(n) else sum(g(i+1)*Co(n-i-1,k-1),i,0,n-k);
makelist(r(n),n,1,12); /*Vladimir Kruchinin, Jun 15 2012 */
-
{a(n) = local(A = x); if( n<1, 0, for( k=1, n-1, A /= (1 - x^k + x * O(x^n))^polcoeff(A, k)); polcoeff(A, n))}; /* Michael Somos, Dec 16 2002 */
-
{a(n) = local(A, A1, an, i); if( n<1, 0, an = Vec(A = A1 = 1 + O(x^n)); for( m=2, n, i=m\2; an[m] = sum( k=1, i, an[k] * an[m-k]) + polcoeff( if( m%2, A *= (A1 - x^i)^-an[i], A), m-1)); an[n])}; /* Michael Somos, Sep 05 2003 */
-
N=66; A=vector(N+1, j, 1);
for (n=1, N, A[n+1] = 1/n * sum(k=1,n, sumdiv(k,d, d*A[d]) * A[n-k+1] ) );
concat([0], A) \\ Joerg Arndt, Apr 17 2014
-
from functools import lru_cache
from sympy import divisors
@lru_cache(maxsize=None)
def divisor_tuple(n): # cached unordered tuple of divisors
return tuple(divisors(n,generator=True))
@lru_cache(maxsize=None)
def A000081(n): return n if n <= 1 else sum(sum(d*A000081(d) for d in divisor_tuple(k))*A000081(n-k) for k in range(1,n))//(n-1) # Chai Wah Wu, Jan 14 2022
-
@CachedFunction
def a(n):
if n < 2: return n
return add(add(d*a(d) for d in divisors(j))*a(n-j) for j in (1..n-1))/(n-1)
[a(n) for n in range(31)] # Peter Luschny, Jul 18 2014 after Alois P. Heinz
-
[0]+[RootedTrees(n).cardinality() for n in range(1,31)] # Freddy Barrera, Apr 07 2019
A105599
Triangle read by rows: T(n, m) = number of forests with n nodes and m labeled trees. Also number of forests with exactly n - m edges on n labeled nodes.
Original entry on oeis.org
1, 1, 1, 3, 3, 1, 16, 15, 6, 1, 125, 110, 45, 10, 1, 1296, 1080, 435, 105, 15, 1, 16807, 13377, 5250, 1295, 210, 21, 1, 262144, 200704, 76608, 18865, 3220, 378, 28, 1, 4782969, 3542940, 1316574, 320544, 55755, 7056, 630, 36, 1, 100000000, 72000000, 26100000, 6258000, 1092105, 143325, 14070, 990, 45, 1
Offset: 1
T(3, 2) = 3 because there are 3 such forests with 3 nodes and 2 trees.
Triangle begins:
1;
1, 1;
3, 3, 1;
16, 15, 6, 1;
125, 110, 45, 10, 1;
1296, 1080, 435, 105, 15, 1;
16807, 13377, 5250, 1295, 210, 21, 1;
- B. Bollobas, Graph Theory - An Introductory Course (Springer-Verlag, New York, 1979)
-
Flat(List([1..11],n->List([1..n],m->(1/Factorial(m)*Sum([0..m],j->(-1/2)^j*Binomial(m,j)*Binomial(n-1,m+j-1)*n^(n-m-j)*Factorial(m+j)))))); # Muniru A Asiru, Apr 01 2018
-
T:= proc(n,m) option remember;
if n<0 then 0
elif n=m then 1
elif m<1 or m>n then 0
else add(binomial(n-1,j-1)*j^(j-2)*T(n-j,m-1), j=1..n-m+1)
fi
end:
seq(seq(T(n, m), m=1..n), n=1..12); # Alois P. Heinz, Sep 10 2008
# The function BellMatrix is defined in A264428.
# Adds (1,0,0,0, ..) as column 0.
BellMatrix(n -> (n+1)^(n-1), 9); # Peter Luschny, Jan 27 2016
-
f[list_]:=Select[list,#>0&];Flatten[Map[f, Transpose[Table[t = Sum[n^(n - 2) x^n/n!, {n, 1, 20}];Drop[Range[0, 8]! CoefficientList[Series[t^k/k!, {x, 0, 8}], x],1], {k, 1, 8}]]]] (* Geoffrey Critzer, Nov 22 2011 *)
T[n_, m_] := Sum[(-1/2)^j*Binomial[m, j]*Binomial[n-1, m+j-1]*n^(n-m-j)*(m + j)!, {j, 0, m}]/m!; Table[T[n, m], {n, 1, 10}, {m, 1, n}] // Flatten (* Jean-François Alcover, Jan 09 2016, after Max Alekseyev *)
rows = 10;
t = Table[(n+1)^(n-1), {n, 0, rows}];
T[n_, k_] := BellY[n, k, t];
Table[T[n, k], {n, 1, rows}, {k, 1, n}] // Flatten (* Jean-François Alcover, Jun 22 2018, after Peter Luschny *)
-
{ T(n,m) = sum(j=0,m, (-1/2)^j * binomial(m,j) * binomial(n-1,m+j-1) * n^(n-m-j)* (m+j)! )/m! } /* Max Alekseyev, Oct 08 2014 */
A027852
Number of connected functions on n points with a loop of length 2.
Original entry on oeis.org
0, 1, 1, 3, 6, 16, 37, 96, 239, 622, 1607, 4235, 11185, 29862, 80070, 216176, 586218, 1597578, 4370721, 12003882, 33077327, 91433267, 253454781, 704429853, 1962537755, 5479855546, 15332668869, 42983656210, 120716987723, 339596063606, 956840683968
Offset: 1
Column 2 of
A033185 (forests of rooted trees),
A217781 (unicyclic graphs),
A339303 (unoriented linear forests) and
A339428 (connected functions).
-
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: a:= n-> (add(b(i) *b(n-i), i=0..n) +`if`(irem(n, 2)=0, b(n/2), 0))/2: seq(a(n), n=1..50); # Alois P. Heinz, Aug 22 2008, revised Oct 07 2011
# second, re-usable version
A027852 := proc(N::integer)
local dh, Nprime;
dh := 0 ;
for Nprime from 0 to N do
dh := dh+A000081(Nprime)*A000081(N-Nprime) ;
end do:
if type(N,'even') then
dh := dh+A000081(N/2) ;
end if;
dh/2 ;
end proc: # R. J. Mathar, Mar 06 2017
-
Needs["Combinatorica`"];nn = 30; s[n_, k_] := s[n, k] = a[n + 1 - k] + If[n < 2 k, 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}]; Take[CoefficientList[CycleIndex[DihedralGroup[2], s] /. Table[s[j] -> Table[Sum[rt[[i]] x^(k*i), {i, 1, nn}], {k, 1, nn}][[j]], {j, 1, nn}], x], {2, nn}] (* Geoffrey Critzer, Oct 12 2012, after code given by Robert A. Russell in A000081 *)
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)];
a[n_] := (Sum[b[i] b[n-i], {i, 0, n}] + If[Mod[n, 2] == 0, b[n/2], 0])/2;
Table[a[n], {n, 1, 50}] (* Jean-François Alcover, Oct 30 2018, after Alois P. Heinz *)
-
seq(max_n)= { my(V = f = vector(max_n), i=1,s); f[1]=1;
for(j=1, max_n - 1, f[j+1] = 1/j * sum(k=1, j, sumdiv(k,d, d * f[d]) * f[j-k+1]));
for(n = 1, max_n, s = sum(k = 1, (n-1)/2, ( f[k] * f[n-k] ));
if(n % 2 == 1, V[i] = s, V[i] = s + (f[n/2]^2 + f[n/2])/2); i++); V };
\\ Washington Bomfim, Jul 06 2012 and Dec 01 2020
A339428
Triangle read by rows: T(n,k) is the number of connected functions on n points with a loop of length k.
Original entry on oeis.org
1, 1, 1, 2, 1, 1, 4, 3, 1, 1, 9, 6, 3, 1, 1, 20, 16, 9, 4, 1, 1, 48, 37, 23, 11, 4, 1, 1, 115, 96, 62, 35, 14, 5, 1, 1, 286, 239, 169, 97, 46, 18, 5, 1, 1, 719, 622, 451, 282, 145, 63, 21, 6, 1, 1, 1842, 1607, 1217, 792, 440, 206, 80, 25, 6, 1, 1
Offset: 1
Triangle begins:
1;
1, 1;
2, 1, 1;
4, 3, 1, 1;
9, 6, 3, 1, 1;
20, 16, 9, 4, 1, 1;
48, 37, 23, 11, 4, 1, 1;
115, 96, 62, 35, 14, 5, 1, 1;
286, 239, 169, 97, 46, 18, 5, 1, 1;
719, 622, 451, 282, 145, 63, 21, 6, 1, 1;
...
Columns 1..12 are
A000081,
A027852,
A029852,
A029853,
A029868,
A029869,
A029870,
A029871,
A032205,
A032206,
A032207,
A032208.
-
\\ TreeGf is A000081 as g.f.
TreeGf(N) = {my(A=vector(N, j, 1)); for (n=1, N-1, A[n+1] = 1/n * sum(k=1, n, sumdiv(k, d, d*A[d]) * A[n-k+1] ) ); x*Ser(A)}
ColSeq(n,k)={my(r=TreeGf(max(0,n+1-k))); Vec(sumdiv(k, d, eulerphi(d)*subst(r + O(x*x^(n\d)), x, x^d)^(k/d))/k, -n)}
M(n, m=n)=Mat(vector(m, k, ColSeq(n,k)~))
{ my(T=M(12)); for(n=1, #T~, print(T[n,1..n])) }
A105784
Number of different forests of unrooted trees, without isolated vertices, on n labeled nodes.
Original entry on oeis.org
0, 1, 3, 19, 155, 1641, 21427, 334377, 6085683, 126745435, 2975448641, 77779634571, 2241339267037, 70604384569005, 2414086713172695, 89049201691604881, 3525160713653081279, 149075374211881719939, 6707440248292609651513, 319946143503599791200675
Offset: 1
a(4) = 19 because there are 19 different such forests on 4 labeled nodes: 4^2 are trees, 3 have two trees and none can have more than two trees.
From _Gus Wiseman_, Apr 28 2024: (Start)
Edge-sets of the a(2) = 1 through a(4) = 19 forests:
12 12,13 12,34
12,23 13,24
13,23 14,23
12,13,14
12,13,24
12,13,34
12,14,23
12,14,34
12,23,24
12,23,34
12,24,34
13,14,23
13,14,24
13,23,24
13,23,34
13,24,34
14,23,24
14,23,34
14,24,34
(End)
For triangles instead of cycles we have
A372168, covering case of
A213434.
A002807 counts cycles in a complete graph.
-
b:= n-> add(add(binomial(m, j) *binomial(n-1, n-m-j)
*n^(n-m-j) *(m+j)!/ (-2)^j, j=0..m)/m!, m=0..n):
a:= n-> add(b(k) *(-1)^(n-k) *binomial(n, k), k=0..n):
seq(a(n), n=1..17); # Alois P. Heinz, Sep 10 2008
-
Unprotect[Power]; 0^0 = 1; b[n_] := Sum[Sum[Binomial[m, j]*Binomial[n-1, n -m-j]*n^(n-m-j)*(m+j)!/(-2)^j, {j, 0, m}]/m!, {m, 0, n}]; a[n_] := Sum[ b[k]*(-1)^(n-k)*Binomial[n, k], {k, 0, n}]; Table[a[n], {n, 1, 17}] (* Jean-François Alcover, Jan 08 2016, after Alois P. Heinz *)
A339067
Triangle read by rows: T(n,k) is the number of linear forests with n nodes and k rooted trees.
Original entry on oeis.org
1, 1, 1, 2, 2, 1, 4, 5, 3, 1, 9, 12, 9, 4, 1, 20, 30, 25, 14, 5, 1, 48, 74, 69, 44, 20, 6, 1, 115, 188, 186, 133, 70, 27, 7, 1, 286, 478, 503, 388, 230, 104, 35, 8, 1, 719, 1235, 1353, 1116, 721, 369, 147, 44, 9, 1, 1842, 3214, 3651, 3168, 2200, 1236, 560, 200, 54, 10, 1
Offset: 1
Triangle begins:
1;
1, 1;
2, 2, 1;
4, 5, 3, 1;
9, 12, 9, 4, 1;
20, 30, 25, 14, 5, 1;
48, 74, 69, 44, 20, 6, 1;
115, 188, 186, 133, 70, 27, 7, 1;
286, 478, 503, 388, 230, 104, 35, 8, 1;
719, 1235, 1353, 1116, 721, 369, 147, 44, 9, 1;
...
-
b:= proc(n) option remember; `if`(n<2, n, (add(add(d*b(d),
d=numtheory[divisors](j))*b(n-j), j=1..n-1))/(n-1))
end:
T:= proc(n, k) option remember; `if`(k=1, b(n), (t->
add(T(j, t)*T(n-j, k-t), j=1..n-1))(iquo(k, 2)))
end:
seq(seq(T(n, k), k=1..n), n=1..12); # Alois P. Heinz, Dec 04 2020
# Using function PMatrix from A357368. Adds row and column for n, k = 0.
PMatrix(10, A000081); # Peter Luschny, Oct 07 2022
-
b[n_] := b[n] = If[n < 2, n, (Sum[Sum[d*b[d], {d, Divisors[j]}]*b[n - j], {j, 1, n - 1}])/(n - 1)];
T[n_, k_] := T[n, k] = If[k == 1, b[n], With[{t = Quotient[k, 2]}, Sum[T[j, t]*T[n - j, k - t], {j, 1, n - 1}]]];
Table[Table[T[n, k], {k, 1, n}], {n, 1, 12}] // Flatten (* Jean-François Alcover, Jan 03 2021, after Alois P. Heinz *)
-
\\ TreeGf is A000081.
TreeGf(N) = {my(A=vector(N, j, 1)); for (n=1, N-1, A[n+1] = 1/n * sum(k=1, n, sumdiv(k, d, d*A[d]) * A[n-k+1] ) ); x*Ser(A)}
ColSeq(n,k)={my(t=TreeGf(max(0,n+1-k))); Vec(t^k, -n)}
M(n, m=n)=Mat(vector(m, k, ColSeq(n,k)~))
{ my(T=M(12)); for(n=1, #T~, print(T[n,1..n])) }
A000226
Number of n-node unlabeled connected graphs with one cycle of length 3.
Original entry on oeis.org
1, 1, 3, 7, 18, 44, 117, 299, 793, 2095, 5607, 15047, 40708, 110499, 301541, 825784, 2270211, 6260800, 17319689, 48042494, 133606943, 372430476, 1040426154, 2912415527, 8167992598, 22947778342, 64577555147, 182009003773, 513729375064, 1452007713130
Offset: 3
- J. Riordan, An Introduction to Combinatorial Analysis, Wiley, 1958, p. 150.
- 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).
- Alois P. Heinz, Table of n, a(n) for n = 3..1000 (first 198 terms from Vincenzo Librandi)
- Sergei Abramovich, Partitions of integers, Ferrers-Young diagrams, and representational efficacy of spreadsheet modeling, Spreadsheets in Education (eJSiE): Vol. 5: Iss. 2, Article 1, p. 5
- Washington Bomfim, Illustration of initial terms
- F. Ruskey, Combinatorial Generation, Eq.(4.27), 2003
- Eric Weisstein's World of Mathematics, Rooted Tree
- Index entries for sequences related to rooted trees
-
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; unapply(add(b(k)*x^k, k=1..n),x) end: a:= n-> coeff(series((B(n-2)(x)^3+ 3*B(n-2)(x)* B(n-2)(x^2)+ 2*B(n-2)(x^3))/6, x=0, n+1), x,n): seq(a(n), n=3..40); # Alois P. Heinz, Aug 21 2008
-
terms = 30; r[] = 0; Do[r[x] = x *Exp[Sum[r[x^k]/k, {k, 1, j}]] + O[x]^j // Normal, {j, 1, terms+3}]; A[x_] = (r[x]^3 + 3*r[x]*r[x^2] + 2*r[x^3])/6 + O[x]^(terms+3); Drop[CoefficientList[A[x], x], 3] (* Jean-François Alcover, Nov 23 2011, updated Jan 11 2018 *)
-
seq(max_n) = {my(a = f = vector(max_n), s, D); f[1]=1;
for(j=1, max_n - 1, f[j+1] = 1/j * sum(k=1, j, sumdiv(k,d, d * f[d]) * f[j-k+1]));
for(n=3,max_n,s=0;forpart(P=n,D=Set(P);if(#D==3,s+=f[P[1]]*f[P[2]]*f[P[3]];next());
if(#D==1, s+= binomial(f[P[1]]+2, 3); next());
if(P[1] == P[2], s += binomial(f[P[1]]+1, 2) * f[P[3]],
s += binomial(f[P[2]]+1, 2) * f[P[1]]),[1,n],[3,3]); a[n] = s ); a[3..max_n] }; \\ Washington Bomfim, Dec 22 2020
A105785
Number of different forests of rooted trees, without isolated vertices, on n labeled nodes.
Original entry on oeis.org
1, 0, 2, 9, 76, 805, 10626, 167839, 3091768, 65127465, 1544951350, 40770052411, 1184951084340, 37616775522781, 1295202587597842, 48080003446006575, 1914305438178286576, 81379323738092982097, 3679128029385789284718, 176267238847686913800547
Offset: 0
a(5) = 805 because there are 625 such trees and 5 vertices can be partitioned in two trees only in one way: 3 go to one tree and 2 go to the other. It's impossible to split 5 vertices in 3 or more trees without giving only one vertex to a tree. Each one of the 3^2 distinct trees on 3 vertices can be labeled in binomial(5,3) ways and to each one of the 9*binomial(5,3) = 90 possibilities there are 2 different trees of order 2, so we get 180 forests of two trees.
-
a:= proc(n) option remember; if n=0 then 1 else add(binomial(n-1, j) *(j+1)^j *a(n-1-j), j=1..n-1) fi end: seq(a(n), n=0..25); # Alois P. Heinz, Sep 15 2008
-
nn=20;t=Sum[n^(n-1)x^n/n!,{n,1,nn}];Drop[Range[0,nn]!CoefficientList[ Series[Exp[t-x] ,{x,0,nn}],x],1] (* Geoffrey Critzer, Nov 10 2012 *)
A106234
Triangle of the numbers of different forests with one or more isolated vertices. Those forests of rooted trees, have order N and m trees.
Original entry on oeis.org
1, 0, 1, 0, 1, 1, 0, 2, 1, 1, 0, 4, 3, 1, 1, 0, 9, 6, 3, 1, 1, 0, 20, 16, 7, 3, 1, 1, 0, 48, 37, 18, 7, 3, 1, 1, 0, 115, 96, 44, 19, 7, 3, 1, 1, 0, 286, 239, 117, 46, 19, 7, 3, 1, 1, 0, 719, 622, 299, 124, 47, 19, 7, 3, 1, 1, 0, 1842, 1607, 793, 320, 126, 47, 19, 7, 3, 1, 1
Offset: 1
a(13) = 3 because 5 vertices can be partitioned in 3 trees in two ways: (1) one tree gets 3 nodes and the others get 1 each. (2) two trees get 2 nodes each and the other gets 1. Case (1) corresponds to 2 forests since A000081(3) = 2. Case (2) corresponds to one forest since A000081(2) = 1.
Triangle T(n,k) begins:
1;
0, 1;
0, 1, 1;
0, 2, 1, 1;
0, 4, 3, 1, 1;
0, 9, 6, 3, 1, 1;
0, 20, 16, 7, 3, 1, 1;
0, 48, 37, 18, 7, 3, 1, 1;
0, 115, 96, 44, 19, 7, 3, 1, 1;
0, 286, 239, 117, 46, 19, 7, 3, 1, 1;
-
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, 0, `if`(i=1,
x^n, 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, 0, If[i == 1, x^n, 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, Mar 09 2015, after Alois P. Heinz *)
Showing 1-10 of 26 results.
Comments