OFFSET
0,3
COMMENTS
A permutation p of [n] has fixed point j if p(j) = j, it has reflected point j if p(n+1-j) = j. A point can be fixed and reflected at the same time.
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..450
T. Simpson, Permutations with unique fixed and reflected points, Preprint. (Annotated scanned copy)
Wikipedia, Permutation
FORMULA
E.g.f.: 2*x/(1-x) - (log(1+x) - log(1-x))/2.
a(0) = 0, a(n) = 2*n! - (n mod 2)*(n-1)! for n > 0.
a(n) = (n-1)*(4*a(n-1)+(n-2)*(4*n-3)*a(n-2))/(4*n-7) for n >= 2, a(n) = n for n < 2.
a(n) = Sum_{k=1..n} k * A335872(n,k).
EXAMPLE
a(3) = 10: (1)(2)(3), (1)32, 21(3), 23(1), (3)12, (3)(2)(1).
MAPLE
b:= proc(s, i) option remember; (n-> `if`(n=0, [1, 0],
add((p-> p+[0, `if`(j in {i, n}, p[1], 0)])(
b(s minus {j}, i+1)), j=s)))(nops(s))
end:
a:= n-> b({$1..n}, 1)[2]:
seq(a(n), n=0..14);
# second Maple program:
a:= n-> `if`(n=0, 0, 2*n! -`if`(n::odd, (n-1)!, 0)):
seq(a(n), n=0..22);
# third Maple program:
a:= proc(n) option remember; `if`(n<2, n, (n-1)*
(4*a(n-1)+(n-2)*(4*n-3)*a(n-2))/(4*n-7))
end:
seq(a(n), n=0..22);
MATHEMATICA
a[n_] := If[n == 0, 0, 2 n! - If[OddQ[n], (n-1)!, 0]];
Table[a[n], {n, 0, 22}] (* Jean-François Alcover, Aug 24 2021, from 2nd Maple program *)
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Alois P. Heinz, Jun 28 2020
STATUS
approved