%I #6 Mar 14 2026 15:01:09
%S 0,1,3,13,66,366,2150,13159,83060,536990,3538667,23684774,160580717,
%T 1100573304,7612835955,53078563117,372638335430,2631988112768,
%U 18689773748375,133350103375528,955513605765357,6873080290918896,49611190313180829,359240625644681554
%N G.f. A(x) satisfies A(x)^4+(2x-1)*A(x)^3+(x^2+2x)*A(x)^2+(2x^2-x)*A(x)+x^2=0.
%C Number of n-vertex planar rooted trees with vertices colored red, blue, and green with red root where red vertices can be followed by vertices of any color, blue vertices can only be followed by blue vertices, and green vertices can only occur as leaves.
%H Nathan Fox, <a href="/A394119/b394119.txt">Table of n, a(n) for n = 0..300</a>
%H S. Dimitrov, N. Fox, K. Hadaway, A. Tharp, and S. Wagner, <a href="https://arxiv.org/abs/2602.16055">Counting Colored Trees</a>, arXiv:2602.16055 [math.CO], 2026.
%o (Python)
%o def A394119(n):
%o A = [[1, 1, 1], [0, 1, 0], [0, 0, 0]]
%o if n == 0:
%o return 0
%o m = len(A)
%o output = [[1] for i in range(m)]
%o for l in range(2, n + 1):
%o for i in range(m):
%o term = 0
%o for k in range(1, l):
%o for j in range(m):
%o term += A[i][j] * output[i][k - 1] * output[j][l - k - 1]
%o output[i].append(term)
%o return output[0][n - 1]
%K nonn
%O 0,3
%A _Nathan Fox_, Mar 11 2026