OFFSET
0,4
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..448
Wikipedia, Permutation
FORMULA
E.g.f.: 1/(2*x-2)-1/(8*(x-1)^3)+log(1-x)*(1-x)/2+(5*x+3)/8.
a(n) = A333706(n+2,n)/16.
EXAMPLE
a(2) = 1: there are 16 permutations p of [4] such that |p(i+2) - p(i)| <> 2 for i in {1,2}: 1243, 1324, 1342, 1423, 2134, 2314, 2413, 2431, 3124, 3142, 3241, 3421, 4132, 4213, 4231, 4312.
MAPLE
a:= proc(n) option remember; `if`(n<3, (n-1)*n/2, a(n-1)*
(n-2)*(n^4+2*n^3-9*n^2+6*n+8)/(n^4-2*n^3-9*n^2+26*n-8))
end:
seq(a(n), n=0..23);
CROSSREFS
KEYWORD
nonn
AUTHOR
Alois P. Heinz, Apr 05 2020
STATUS
approved