OFFSET
0,4
COMMENTS
Number of ternary strings of length n such that the number of 0's and 1's in total is at least two and there is at least one 2. For example, a(3)=12 since the strings are (number of permutations in parentheses): 002 (3), 112 (3), 012 (6).
Also the number of ordered set partitions of an n-set into 3 sets such that the number of elements in the first and second sets in total is at least two and the third set has at least one element.
LINKS
Andrew Howroyd, Table of n, a(n) for n = 0..1000
Index entries for linear recurrences with constant coefficients, signature (7,-17,17,-6).
FORMULA
E.g.f.: (exp(x)-1)*(exp(2*x)-2*x-1).
G.f.: 4*x^3*(3 - 7*x + 3*x^2)/((1 - x)^2*(1 - 2*x)*(1 - 3*x)). - Andrew Howroyd, Nov 06 2025
EXAMPLE
a(3)=12 since the ordered set partitions are: {1,2}{ }{3}, {1,3}{ }{2}, {2,3}{ }{1}, { }{1,2}{3}, { }{1,3}{2}, { }{2,3}{1}, {1}{2}{3}, {1}{3}{2}, {2}{1}{3}, {2}{3}{1}, {3}{1}{2}, {3}{2}{1}.
MATHEMATICA
a[n_] := 3^n - 2^n - 2*n - 1; a[0] = a[1] = 0; Array[a, 30, 0] (* Amiram Eldar, Oct 21 2025 *)
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Enrique Navarrete, Oct 21 2025
STATUS
approved
