OFFSET
0,2
LINKS
Index entries for linear recurrences with constant coefficients, signature (2, 2, 1).
FORMULA
a(n) = 2*a(n-1) + 2*a(n-2) + a(n-3).
G.f.: (1+x+x^2) / (1-2*x-2*x^2-x^3).
a(n-1) = sum(k=1..n, sum(m=0..n-k, (sum(j=0..k, binomial(j, n-m-3*k+2*j) *binomial(k, j))) *sum(i=ceiling(m/2)..m, binomial(i, m-i)*binomial(k+i-1, k-1)))). - Vladimir Kruchinin, May 05 2011
EXAMPLE
a => aab => aabaabaac => aabaabaacaabaabaacaabaaba, thus a(0) = 1, a(1) = 3, a(2) = 9, a(3) = 25.
MAPLE
a:= n-> (<<0|1|0>, <0|0|1>, <1|2|2>>^n. <<1, 3, 9>>)[1, 1]:
seq(a(n), n=0..30); # Alois P. Heinz, May 06 2011
MATHEMATICA
Length/@SubstitutionSystem[{a->{a, a, b}, b->{a, a, c}, c->a}, {a}, 15] (* The program generates the first 16 terms of the sequence. To generate more, increase the final ("15") constant. *) (* Harvey P. Dale, Sep 05 2022 *)
PROG
(Maxima) a(n):=b(n+1);
b(n):= sum(sum((sum(binomial(j, n+1-m-3*k+2*j) *binomial(k, j), j, 0, k)) *sum(binomial(i, m-i) *binomial(k+i-1, k-1), i, ceiling(m/2), m), m, 0, n+1-k), k, 1, n+1); /* Vladimir Kruchinin, May 05 2011 */
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Jeroen F.J. Laros, Jan 22 2005
STATUS
approved