A335873 Total number of points in all permutations of [n] that are fixed or reflected.
0, 1, 4, 10, 48, 216, 1440, 9360, 80640, 685440, 7257600, 76204800, 958003200, 11975040000, 174356582400, 2528170444800, 41845579776000, 690452066304000, 12804747411456000, 236887827111936000, 4865804016353280000, 99748982335242240000, 2248001455555215360000
Offset: 0
Examples
a(3) = 10: (1)(2)(3), (1)32, 21(3), 23(1), (3)12, (3)(2)(1).
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
Crossrefs
Programs
-
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 *)
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).
Comments