login
A386359
a(n) = (1/4)*(9^n - 2*4^n + 3), n > 0; a(0) = 0.
1
0, 1, 13, 151, 1513, 14251, 130813, 1187551, 10728913, 96724051, 871171813, 7843167751, 70598995513, 635432902651, 5719063896013, 51472246152751, 463252899729313, 4169286834982051, 37523624464511413, 337712791979294551, 3039415815008418313, 27354745083854834251
OFFSET
0,3
COMMENTS
a(n) is the number of ternary strings of length 2*n with an even number of 1's and 2's (possibly zero) and a positive even number of 0's.
FORMULA
a(n) = 14*a(n-1) - 49*a(n-2) + 36*a(n-3), n > 3.
G.f.: (18*x^3 - x^2 + x)/((1 - 9*x)*(1 - 4*x)*(1 - x)).
E.g.f.: (1/4)*(exp(9*x) - 2*exp(4*x) + 3*exp(x) - 2).
EXAMPLE
For n=2, a(2)=13 since the strings of length 4 are (number of permutations in parentheses): 0022 (6), 0011 (6), 0000 (1).
For n=3, a(3)=151 since the strings of length 6 are (number of permutations in parentheses): 000000 (1), 000022 (15), 002222(15), 000011 (15), 001111 (15), 001122 (90).
MATHEMATICA
LinearRecurrence[{14, -49, 36}, {0, 1, 13, 151}, 23] (* Stefano Spezia, Jul 19 2025 *)
PROG
(Magma) I:=[0, 1, 13, 151]; [n le 4 select I[n] else 14*Self(n-1)-49*Self(n-2)+36*Self(n-3): n in [1..30]]; // Vincenzo Librandi, Jul 24 2025
CROSSREFS
Sequence in context: A382898 A242576 A173448 * A396245 A097168 A382516
KEYWORD
nonn,easy
AUTHOR
Enrique Navarrete, Jul 19 2025
STATUS
approved