%I #31 Apr 26 2021 08:52:45
%S 1,1,2,4,8,14,28,52,104,206,429,903,1982,4430,10206,23966,57522,
%T 140236,347302,870682,2207819,5651437,14590703,37948338,99358533,
%U 261684141,692906575,1843601797,4926919859,13220064562,35604359531,96218568474,260850911485
%N Number of simple unlabeled graphs on n nodes with connected components that are trees or cycles.
%H Alois P. Heinz, <a href="/A215978/b215978.txt">Table of n, a(n) for n = 0..1000</a>
%F a(n) = Sum_{k=0..n} A215977(n,k).
%F a(n) ~ c * d^n / n^(5/2), where d = A051491 = 2.95576528565199497471481752412... is Otter's rooted tree constant, and c = 1.085767435235426664262830616636... . - _Vaclav Kotesovec_, Mar 22 2017
%e a(4) = 8:
%e .o-o. .o-o. .o-o. .o-o. .o-o. .o-o. .o-o. .o o.
%e .| |. .| . .|\ . .|/ . .| . . . . . . .
%e .o-o. .o-o. .o o. .o o. .o o. .o-o. .o o. .o o.
%p with(numtheory):
%p b:= proc(n) option remember; local d, j; `if`(n<=1, n,
%p (add(add(d*b(d), d=divisors(j)) *b(n-j), j=1..n-1))/(n-1))
%p end:
%p g:= proc(n) option remember; local k; `if`(n>2, 1, 0)+ b(n)-
%p (add(b(k)*b(n-k), k=0..n) -`if`(irem(n, 2)=0, b(n/2), 0))/2
%p end:
%p p:= proc(n, i) option remember; `if`(n=0, 1, `if`(i<1, 0,
%p add(binomial(g(i)+j-1,j)*p(n-i*j, i-1), j=0..n/i)))
%p end:
%p a:= n-> p(n, n):
%p seq(a(n), n=0..40);
%t 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)];
%t 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;
%t p[n_, i_] := p[n, i] = If[n == 0, 1, If[i < 1, 0, Sum[Binomial[g[i] + j - 1, j]*p[n - i*j, i - 1], {j, 0, n/i}]]];
%t a[n_] := p[n, n];
%t Table[a[n], {n, 0, 40}] (* _Jean-François Alcover_, Mar 21 2017, translated from Maple *)
%o (Python)
%o from sympy.core.cache import cacheit
%o from sympy import binomial, divisors
%o @cacheit
%o 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)
%o @cacheit
%o 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
%o @cacheit
%o def p(n, i): return 1 if n==0 else 0 if i<1 else sum([binomial(g(i) + j - 1, j)*p(n - i*j, i - 1) for j in range(n//i + 1)])
%o def a(n): return p(n, n)
%o print([a(n) for n in range(41)]) # _Indranil Ghosh_, Aug 07 2017
%Y Row sum of A215977.
%Y The labeled version is A144164. The inverse Euler transform is A215981.
%K nonn
%O 0,3
%A _Alois P. Heinz_, Aug 29 2012