OFFSET
0,4
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 two elements are selected from the second set.
Note the coefficients 1,3,6,10 in a(n) are triangular numbers (in accordance with the selection of two elements from the second set).
LINKS
Index entries for linear recurrences with constant coefficients, signature (6,-15,20,-15,6,-1).
FORMULA
E.g.f.: (1 + x + x^2/2 + x^3/6)*x^2/2*exp(x).
O.g.f.: x^2*(1 + 3*x^2 + 6*x^3)/(1 - x)^6. - Stefano Spezia, Mar 16 2023
EXAMPLE
The 546 set partitions for n=7 are the following (where the 2 elements selected from the second set are in parentheses):
{ }, {(1),(2),3,4,5,6,7} (21 of these);
{1}, {(2),(3),4,5,6,7} (105 of these);
{1,2}, {(3),(4),5,6,7} (210 of these);
{1,2,3}, {(4),(5),6,7} (210 of these).
MATHEMATICA
a[n_] := Total[Binomial[n, Range[2, 5]]*{1, 3, 6, 10}]; Array[a, 40, 0] (* Amiram Eldar, Mar 28 2023 *)
PROG
(PARI) a(n) = binomial(n, 2) + 3*binomial(n, 3) + 6*binomial(n, 4) + 10*binomial(n, 5); \\ Michel Marcus, Mar 16 2023
(Python)
def A361474(n): return n*(n*(n*(n*(n - 7) + 23) - 29) + 12)//12 # Chai Wah Wu, Apr 16 2023
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Enrique Navarrete, Mar 13 2023
STATUS
approved