login
Number of unlabeled rooted trees with n nodes in which all outdegrees are either 0, 1, or 3.
12

%I #15 May 10 2021 15:34:19

%S 1,1,1,2,3,5,9,16,29,55,104,200,389,763,1507,3002,6010,12102,24484,

%T 49751,101475,207723,426542,878451,1813945,3754918,7790326,16196629,

%U 33739335,70410401,147187513,308171861,646188276,1356847388,2852809425,6005542176

%N Number of unlabeled rooted trees with n nodes in which all outdegrees are either 0, 1, or 3.

%H Alois P. Heinz, <a href="/A298204/b298204.txt">Table of n, a(n) for n = 1..1000</a>

%H Gus Wiseman, <a href="/A298204/a298204.png">Illustration of the first 8 terms.</a>

%e The a(7) = 9 trees: ((((((o)))))), ((((ooo)))), (((oo(o)))), ((oo((o)))), ((o(o)(o))), (oo(((o)))), (oo(ooo)), (o(o)((o))), ((o)(o)(o)).

%p b:= proc(n, i, v) option remember; `if`(n=0,

%p `if`(v=0, 1, 0), `if`(i<1 or v<1 or n<v, 0,

%p `if`(n=v, 1, add(binomial(a(i)+j-1, j)

%p *b(n-i*j, i-1, v-j), j=0..min(n/i, v)))))

%p end:

%p a:= n-> `if`(n<2, n, add(b(n-1$2, j), j=[1, 3])):

%p seq(a(n), n=1..40); # _Alois P. Heinz_, Jan 30 2018

%t multing[n_,k_]:=Binomial[n+k-1,k];

%t a[n_]:=a[n]=If[n===1,1,Sum[Product[multing[a[x],Count[ptn,x]],{x,Union[ptn]}],{ptn,Select[IntegerPartitions[n-1],MemberQ[{1,3},Length[#]]&]}]];

%t Table[a[n],{n,40}]

%t (* Second program: *)

%t b[n_, i_, v_] := b[n, i, v] = If[n == 0,

%t If[v == 0, 1, 0], If[i < 1 || v < 1 || n < v, 0,

%t If[n == v, 1, Sum[Binomial[a[i] + j - 1, j]*

%t b[n - i*j, i - 1, v - j], {j, 0, Min[n/i, v]}]]]];

%t a[n_] := If[n < 2, n, Sum[b[n - 1, n - 1, j], {j, {1, 3}}]];

%t Array[a, 40] (* _Jean-François Alcover_, May 10 2021, after _Alois P. Heinz_ *)

%Y Cf. A000081, A000598, A001190, A001399, A004111, A014591, A032305, A273873, A292050, A295461, A298118, A298205.

%K nonn

%O 1,4

%A _Gus Wiseman_, Jan 14 2018