OFFSET
0,4
COMMENTS
Equivalently, the number of bandwidth-at-most-2 arrangements of a straight line of n vertices.
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..2000
Index entries for linear recurrences with constant coefficients, signature (3,-3,2,-2,1).
FORMULA
EXAMPLE
For example, the six Hamiltonian paths when n=4 are 1234, 1243, 1324, 1342, 2134, 3124.
MAPLE
a:= n-> (Matrix([[1, 1, 1, 0, 1]]). Matrix(5, (i, j)-> if i=j-1 then 1 elif j=1 then [3, -3, 2, -2, 1][i] else 0 fi)^n)[1, 3]: seq(a(n), n=0..50); # Alois P. Heinz, Sep 09 2008
MATHEMATICA
a[0] = a[1] = a[2] = 1; a[3] = 3; a[4] = 6; a[n_] := a[n] = 3a[n-1] - 3a[n-2] + 2a[n-3] - 2a[n-4] + a[n-5]; Table[a[n], {n, 0, 38}] (* Jean-François Alcover, Feb 13 2015 *)
CoefficientList[Series[(3+x+x^2)/(1-x-x^3)-(2-x)/(1-x)^2, {x, 0, 60}], x] (* or *) LinearRecurrence[{3, -3, 2, -2, 1}, {1, 1, 1, 3, 6}, 60] (* Harvey P. Dale, Apr 07 2019 *)
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Don Knuth, Apr 13 2002
STATUS
approved