A386359 a(n) = (1/4)*(9^n - 2*4^n + 3), n > 0; a(0) = 0.
0, 1, 13, 151, 1513, 14251, 130813, 1187551, 10728913, 96724051, 871171813, 7843167751, 70598995513, 635432902651, 5719063896013, 51472246152751, 463252899729313, 4169286834982051, 37523624464511413, 337712791979294551, 3039415815008418313, 27354745083854834251
Offset: 0
Examples
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).
Links
- Vincenzo Librandi, Table of n, a(n) for n = 0..300
- Index entries for linear recurrences with constant coefficients, signature (14,-49,36).
Programs
-
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
-
Mathematica
LinearRecurrence[{14,-49,36},{0,1,13,151},23] (* Stefano Spezia, Jul 19 2025 *)
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).
Comments