OFFSET
0,3
COMMENTS
Conjecture: a(n) is the number of compositions of n if all the 1's are constrained to be in a single run; for example, a(7) counts the compositions 4,1,1,1 and 1,1,1,4 but not the compositions 1,4,1,1 and 1,1,4,1. - Gregory L. Simay, Sep 29 2018
This also gives the number of ordered partitions of n into parts of sizes 1, 2, and 3 with at most one 3. - Jerrold Grossman, Apr 03 2024
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..1000
Jia Huang, Partially Palindromic Compositions, J. Int. Seq. (2023) Vol. 26, Art. 23.4.1. See p. 11.
Index entries for linear recurrences with constant coefficients, signature (2,1,-2,-1).
FORMULA
EXAMPLE
a(4) = 7: {4, 13, 31, 112, 121, 211, 1111}.
a(5) = 13: {5, 14, 41, 23, 32, 113, 131, 311, 1112, 1121, 1211, 2111, 11111}.
a(6) = 23: {6, 15, 51, 33, 114, 141, 411, 123, 132, 213, 231, 312, 321, 1113, 1131, 1311, 3111, 11112, 11121, 11211, 12111, 21111, 111111}.
MAPLE
a:= n-> (<<0|1|0|0>, <0|0|1|0>, <0|0|0|1>, <-1|-2|1|2>>^n.
<<1, 1, 2, 4>>)[1, 1]:
seq(a(n), n=0..40);
MATHEMATICA
LinearRecurrence[{2, 1, -2, -1}, {1, 1, 2, 4}, 40] (* Jean-François Alcover, Feb 18 2017 *)
CoefficientList[Series[((-1 + x)^2 (1 + x))/(-1 + x + x^2)^2, {x, 0, 50}], x] (* Stefano Spezia, Oct 29 2018 *)
PROG
(PARI) x='x+O('x^50); Vec((x+1)*(x-1)^2/(x^2+x-1)^2) \\ Altug Alkan, Oct 02 2018
(GAP) T:=n->((2*n+3)*Fibonacci(n)-n*Fibonacci(n-1))/5; a:=List([0..40], n->T(n+1)-T(n-1)); # Muniru A Asiru, Oct 28 2018
(Magma) I:=[1, 1, 2, 4]; [n le 4 select I[n] else 2*Self(n-1)+Self(n-2)-2*Self(n-3)-Self(n-4): n in [1..40]]; // Vincenzo Librandi, Oct 29 2018
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Alois P. Heinz, Feb 25 2012
STATUS
approved