OFFSET
0,2
COMMENTS
Also the number of length-n ternary words containing no palindromes of length > 2.
LINKS
Colin Barker, Table of n, a(n) for n = 0..1000
Lukas Fleischer, Jeffrey Shallit, Words Avoiding Reversed Factors, Revisited, arXiv:1911.00248 [cs.FL], November 26 2019.
Lukas Fleischer, Jeffrey Shallit, Words With Few Palindromes, Revisited, arxiv preprint arXiv:1911.12464 [cs.FL], November 27 2019.
Index entries for linear recurrences with constant coefficients, signature (1,1).
FORMULA
a(n) = 6*F(n+1) for n >= 3, where F(n) is the n-th Fibonacci number.
From Colin Barker, Nov 27 2019: (Start)
G.f.: (1 + 2*x + 5*x^2 + 6*x^3 + 3*x^4) / (1 - x - x^2).
a(n) = a(n-1) + a(n-2) for n>4.
(End)
EXAMPLE
For n = 4, the 30 strings are 0011, 0012, 0112, 0120, 0122 and the 25 similar strings formed by permutation of the alphabet.
MATHEMATICA
CoefficientList[Series[(1 + 2 x + 5 x^2 + 6 x^3 + 3 x^4)/(1 - x - x^2), {x, 0, 36}], x] (* Michael De Vlieger, Dec 01 2019 *)
PROG
(PARI) Vec((1 + 2*x + 5*x^2 + 6*x^3 + 3*x^4) / (1 - x - x^2) + O(x^40)) \\ Colin Barker, Nov 27 2019
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Jeffrey Shallit, Nov 27 2019
STATUS
approved