A385689 a(n) = 6*binomial(n,4) + 6*binomial(n,3) + 4*binomial(n,2) + 2*n + 1.
1, 3, 9, 25, 63, 141, 283, 519, 885, 1423, 2181, 3213, 4579, 6345, 8583, 11371, 14793, 18939, 23905, 29793, 36711, 44773, 54099, 64815, 77053, 90951, 106653, 124309, 144075, 166113, 190591, 217683, 247569, 280435, 316473, 355881, 398863, 445629, 496395, 551383, 610821, 674943
Offset: 0
Examples
a(3) = 25 since from the 27 ternary strings of length 3 we exclude the strings 111 and 222.
Links
- Index entries for linear recurrences with constant coefficients, signature (5,-10,10,-5,1).
Crossrefs
Cf. A127873.
Programs
-
Mathematica
LinearRecurrence[{5,-10,10,-5,1},{1, 3, 9, 25, 63},42] (* Stefano Spezia, Jul 07 2025 *)
-
Python
def A385689(n): return (n*(n*(n*(n-2)+7)+2)>>2)+1 # Chai Wah Wu, Jul 12 2025
Formula
a(n) = (1/4)*n^4 - (1/2)*n^3 + (7/4)*n^2 + (1/2)*n + 1.
G.f.: (3*x^4 + 4*x^2 - 2*x + 1)/(1 - x)^5.
E.g.f.: exp(x)*(1 + x + x^2/2)^2.
Comments