OFFSET
0,4
COMMENTS
Hexagonal numbers and odd numbers interleaved.
a(n) is the number of ternary strings of length n that contain exactly one 0 and no 1's or exactly two 1's and no 0's, and in both cases, an even number of 2's.
LINKS
Paolo Xausa, Table of n, a(n) for n = 0..10000
Index entries for linear recurrences with constant coefficients, signature (0,3,0,-3,0,1).
FORMULA
a(n) = (n/2)*(n-1), n even; a(n) = n, n odd.
G.f.: x*(1 + x + 3*x^3 - x^4)/(1 - x^2)^3. - Stefano Spezia, Jun 17 2025
EXAMPLE
a(7) = 7 since the strings are the 7 permutations of 0222222.
a(8) = 28 since the strings are the 28 permutations of 11222222.
MATHEMATICA
LinearRecurrence[{0, 3, 0, -3, 0, 1}, {0, 1, 1, 3, 6, 5}, 100] (* Paolo Xausa, Jan 07 2026 *)
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Enrique Navarrete, Jun 17 2025
STATUS
approved
