OFFSET
4,1
LINKS
Alois P. Heinz, Table of n, a(n) for n = 4..2000
Index entries for linear recurrences with constant coefficients, signature (2,1,-1,-2,-1).
FORMULA
G.f.: -x^4*(10*x^4+23*x^3+17*x^2-x-15)/((x^2+x-1)*(x^3+x^2+x-1)).
EXAMPLE
a(4) = 15: 1243, 1324, 1342, 2134, 2143, 2314, 2341, 2413, 2431, 3142, 3241, 3421, 4231, 4312, 4321.
a(5) = 31: 12534, 12543, 14235, 14325, 14523, 14532, 15342, 31245, 31524, 31542, 32145, 32514, 34125, 34215, 34512, 35124, 35142, 35214, 41523, 41532, 42315, 42513, 45132, 45213, 45312, 51342, 52314, 54123, 54132, 54213, 54312.
MAPLE
a:= n-> `if`(n<4, 0, (<<0|1|0|0|0>, <0|0|1|0|0>, <0|0|0|1|0>,
<0|0|0|0|1>, <-1|-2|-1|1|2>>^n. <<4, 1, 3, 10, 15>>)[1$2]):
seq(a(n), n=4..40);
MATHEMATICA
LinearRecurrence[{2, 1, -1, -2, -1}, {15, 31, 60, 113, 215}, 40] (* Vincenzo Librandi, Jun 06 2019 *)
PROG
(Magma) I:=[15, 31, 60, 113, 215]; [n le 5 select I[n] else 2*Self(n-1)+Self(n-2)-Self(n-3)-2*Self(n-4)+Self(n-5): n in [1..40]]; // Vincenzo Librandi, Jun 06 2019
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Alois P. Heinz, Mar 09 2019
STATUS
approved