OFFSET
0,4
COMMENTS
a(n) is the number of words of length n defined on a 4-letter alphabet where one of the letters is used at least twice and another letter is used at least once.
LINKS
Paolo Xausa, Table of n, a(n) for n = 0..1000
Index entries for linear recurrences with constant coefficients, signature (14,-77,208,-276,144).
FORMULA
E.g.f.: (exp(x)-x-1)*(exp(3*x)-exp(2*x)).
G.f.: x^3*(3 - 8*x)/((1 - 4*x)*(1 - 5*x + 6*x^2)^2). - Stefano Spezia, Mar 07 2025
EXAMPLE
For n=4 the 34 words that use 0 at least twice and 1 at least once are 0001 (4 of this type), 0011 (6 of this type), 0012 (12 of this type), 0013 (12 of this type).
MATHEMATICA
A381643[n_] := 4^n - (n+6)*3^(n-1) + (n+2)*2^(n-1);
Array[A381643, 30, 0] (* Paolo Xausa, Jan 22 2026 *)
PROG
(Python)
def A381643(n): return ((1<<n+1)+n+2<<n-1)-(n+6)*3**(n-1) if n else 0 # Chai Wah Wu, Mar 15 2025
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Enrique Navarrete, Mar 03 2025
STATUS
approved
