cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

Showing 1-1 of 1 results.

A335873 Total number of points in all permutations of [n] that are fixed or reflected.

Original entry on oeis.org

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

Views

Author

Alois P. Heinz, Jun 28 2020

Keywords

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.

Examples

			a(3) = 10: (1)(2)(3), (1)32, 21(3), 23(1), (3)12, (3)(2)(1).
		

Crossrefs

Bisection (even part) gives 2 * A010050(n) for n>0.

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).
Showing 1-1 of 1 results.