OFFSET
0,5
COMMENTS
a(n) is the number of ordered set partitions of an n-set into 2 sets such that the first set has either 3, 2, 1 or no elements, the second set has no restrictions, and three elements are selected from the second set.
Note that the coefficients 1,4,10,20 in formula for a(n) are triangular pyramidal numbers (in accordance with the selection of three elements from the second set).
a(n) is also the number of ternary strings of length n with exactly three 1's, at most three 0's and any number of 2's.
LINKS
Index entries for linear recurrences with constant coefficients, signature (7,-21,35,-35,21,-7,1).
FORMULA
a(n) = n*(n-1)*(n-2)^2*(n^2-7*n+18)/36.
E.g.f.: (1 + x + x^2/2 + x^3/6)*x^3/6*exp(x).
G.f.: x^3*(1 + x + 5*x^2 + 13*x^3)/(1 - x)^7. - Stefano Spezia, May 03 2026
EXAMPLE
The 525 set partitions for n=7 are the following (where the 3 elements selected from the second set are in parentheses):
{ }, {(1),(2),(3),4,5,6,7} (35 of these);
{1}, {(2),(3),(4),5,6,7} (140 of these);
{1,2}, {(3),(4),(5),6,7} (210 of these);
{1,2,3}, {(4),(5),(6),7} (140 of these).
MATHEMATICA
a[n_]:=n*(n-1)*(n-2)^2*(n^2-7*n+18)/36; Array[a, 37, 0] (* Stefano Spezia, May 03 2026 *)
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Enrique Navarrete, Apr 29 2026
STATUS
approved
