login
A383797
a(n) = 10*binomial(n,5) + 4*binomial(n,3) + n.
2
0, 1, 2, 7, 20, 55, 146, 357, 792, 1605, 3010, 5291, 8812, 14027, 21490, 31865, 45936, 64617, 88962, 120175, 159620, 208831, 269522, 343597, 433160, 540525, 668226, 819027, 995932, 1202195, 1441330, 1717121, 2033632, 2395217, 2806530, 3272535, 3798516, 4390087, 5053202
OFFSET
0,3
COMMENTS
a(n) is the number of ternary strings of length n that contain one or three 1's, zero or two 2's, and have no restriction on the number of 0's.
FORMULA
a(n) = (13/3)*n - (37/6)*n^2 + (43/12)*n^3 - (5/6)*n^4 + (1/12)*n^5.
G.f.: (x*(1 - 4*x + 10*x^2 - 12*x^3 + 15*x^4))/(1 - x)^6.
E.g.f.: exp(x)*(1+x^2/2)*(x+x^3/6).
a(n) = 6*a(n-1) - 15*a(n-2) + 20*a(n-3) - 15*a(n-4) + 6*a(n-5) - a(n-6) for n > 5. - Chai Wah Wu, May 20 2025
EXAMPLE
a(5) = 55 since the strings are the 5 permutations of 10000, the 10 permutations of 11100, the 10 permutations of 11122 and the 30 permutations of 12200.
MATHEMATICA
LinearRecurrence[{6, -15, 20, -15, 6, -1}, {0, 1, 2, 7, 20, 55}, 30] (* Vincenzo Librandi, May 21 2025 *)
PROG
(Magma) [(13/3)*n - (37/6)*n^2 + (43/12)*n^3 - (5/6)*n^4 + (1/12)*n^5: n in [0..40]]; // Vincenzo Librandi, May 21 2025
CROSSREFS
Sequence in context: A035508 A018033 A000149 * A080041 A049681 A027120
KEYWORD
nonn,easy
AUTHOR
Enrique Navarrete, May 15 2025
STATUS
approved