login
A387185
a(n) = n*2^(n-1) + binomial(n,2)*2^(n-2) + binomial(n,3)*2^(n-3).
0
0, 1, 5, 19, 64, 200, 592, 1680, 4608, 12288, 32000, 81664, 204800, 505856, 1232896, 2969600, 7077888, 16711680, 39124992, 90898432, 209715200, 480772096, 1095761920, 2484076544, 5603590144, 12582912000, 28135391232, 62662901760, 139049566208, 307492814848, 677799526400
OFFSET
0,3
COMMENTS
Number of ternary strings of length n that contain one, two or three 0's.
Number of words of length n defined on five letters that contain one a or 2 b's or 3 c's and any number of d's and e's.
FORMULA
E.g.f.: (1 + x/2 + x^2/6)*x*exp(2*x).
G.f.: x*(1-3*x+3*x^2)/(2*x-1)^4 . - R. J. Mathar, Aug 26 2025
a(n) = n*2^n*(20+3*n+n^2)/48. - R. J. Mathar, Aug 26 2025
EXAMPLE
a(3) = 19 since the words are (number of permutations in parentheses): add (3), ade (6), aee (3), bbd (3), bbe (3), ccc (1).
a(4) = 64 since from the 81 strings of length 4 we subtract the following 17 (number of permutations in parentheses): 0000 (1), 1111 (1), 1112 (4), 1122 (6), 1222 (4), 2222 (1).
MATHEMATICA
a[n_] := Sum[2^(n-k)*Binomial[n, k], {k, 1, 3}]; Array[a, 30, 0] (* Amiram Eldar, Aug 21 2025 *)
CROSSREFS
Sequence in context: A377659 A211842 A304134 * A318946 A378383 A229239
KEYWORD
nonn,easy
AUTHOR
Enrique Navarrete, Aug 21 2025
STATUS
approved