OFFSET
0,2
LINKS
Paolo Xausa, Table of n, a(n) for n = 0..1000
Index entries for linear recurrences with constant coefficients, signature (14,-72,162,-135).
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
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Enrique Navarrete, Dec 01 2025
STATUS
approved
