login
A387680
Number of length n words on the alphabet {a,b,c,d,e} that do not contain exactly one a and exactly one b.
2
1, 5, 23, 107, 517, 2585, 13195, 67919, 349801, 1795661, 9175135, 46662995, 236346157, 1193068193, 6006793363, 30182770295, 151439978065, 759036550421, 3801524968999, 19029320392379, 95220211854805, 476349008386985, 2382574896622363, 11915636016357407, 59587322430486457
OFFSET
0,2
FORMULA
a(n) = 5^n - n*(n-1)*3^(n-2).
E.g.f.: exp(3*x)*(exp(2*x) - x^2).
G.f.: (1 - x)*(1 - 8*x + 17*x^2)/((1 - 5*x)*(1 - 3*x)^3). - Robert Israel, Dec 02 2025
a(n) = 5^n - A006043(n-2).
EXAMPLE
a(2) = 23 since there are 25 length-2 strings and all work except ab and ba.
a(4) = 517 since from the 625 words of length 4 we subtract the following 108 (number of permutations in parentheses): abcc (12), abdd (12), abee (12), abcd (24), abce (24), abde (24).
MATHEMATICA
A387680[n_] := 5^n - n*(n - 1)*3^(n - 2); Array[A387680, 25, 0] (* Paolo Xausa, Jan 02 2026 *)
CROSSREFS
Sequence in context: A026894 A126473 A238112 * A109877 A336704 A179598
KEYWORD
nonn,easy
AUTHOR
Enrique Navarrete, Dec 01 2025
STATUS
approved