OFFSET
1,3
LINKS
Colin Barker, Table of n, a(n) for n = 1..1000
Index entries for linear recurrences with constant coefficients, signature (2,-1,2,-1,0,-1).
FORMULA
G.f.: x*(1-x+x^2-x^3-x^5) / ((1-x)*(1+x^2)*(1-x-x^2-x^3)). - Colin Barker, Jan 31 2016
EXAMPLE
There exist two even permutations p of 1,2,3 such that -1<=p(i)-i<=2 for i=1,2,3: (123) and (312), therefore a(3)=2.
MATHEMATICA
CoefficientList[Series[(1 - x + x^2 - x^3 - x^5)/((1 - x) (1 + x^2) (1 - x - x^2 - x^3)), {x, 0, 34}], x] (* Michael De Vlieger, Feb 01 2016 *)
PROG
(Maxima) t1:0$ t2:0$ t3:1$ for i:1 thru 100 do (a:1/2+sin((2*i+1)*%pi/4)/sqrt(2),
t:t1+t2+t3, t1:t2, t2:t3, t3:t, e:(t+a)/2, print(e));
(PARI) Vec(x*(1-x+x^2-x^3-x^5)/((1-x)*(1+x^2)*(1-x-x^2-x^3)) + O(x^50)) \\ Colin Barker, Jan 31 2016
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Dmitry Efimov, Jan 31 2016
STATUS
approved