A385726 a(n) = 3^n - 6*binomial(n,4) - 6*binomial(n,3) - 4*binomial(n,2) - 2*n - 1.
0, 0, 0, 2, 18, 102, 446, 1668, 5676, 18260, 59049, 177147, 531441, 1594323, 4782969, 14348907, 43046721, 129140163, 387420489, 1162261467, 3486784401, 10460353203, 31381059609, 94143178827, 282429536481, 847288609443, 2541865828329, 7625597484987, 22876792454961, 68630377364883
Offset: 0
Examples
a(3)= 2 since the strings are 111 and 222. a(4) = 18 since the strings are (number of permutations in parentheses): 1111 (1), 1112 (4), 1110 (4), 1222 (4), 0222 (4), 2222 (1).
Links
- Index entries for linear recurrences with constant coefficients, signature (3).
Formula
E.g.f.: exp(x)*(exp(2*x)-(1 + x + x^2/2)^2).
a(n) = 3^n - A385689(n).
G.f.: x^3*(2 + 12*x + 48*x^2 + 140*x^3 + 330*x^4 + 672*x^5 + 1232*x^6 + 4269*x^7)/(1 - 3*x). - Stefano Spezia, Jul 08 2025
Comments