OFFSET
0,2
LINKS
Colin Barker, Table of n, a(n) for n = 0..1000
Index entries for linear recurrences with constant coefficients, signature (7,-15,9).
FORMULA
From Colin Barker, Jul 05 2017: (Start)
G.f.: 3*x / ((1 - x)*(1 - 3*x)^2).
a(n) = 3*(1 - 3^n + 2*3^n*n) / 4.
a(n) = 7*a(n-1) - 15*a(n-2) + 9*a(n-3) for n>2.
(End)
EXAMPLE
The complete ternary tree of height two consists of one root node (at depth 0), three children of the root (at depth 1) and 9 leaf nodes (at depth 2). Thus a(2) = 0 + 3*1 + 9*2 = 21.
PROG
(PARI) concat(0, Vec(3*x / ((1 - x)*(1 - 3*x)^2) + O(x^30))) \\ Colin Barker, Jul 05 2017
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
F. Skerman, Jul 05 2017
STATUS
approved