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.

A306511 Number of permutations p of [n] having at least one index i with |p(i)-i| = 1.

Original entry on oeis.org

0, 0, 1, 4, 19, 99, 603, 4248, 34115, 307875, 3085203, 33993870, 408482695, 5316309607, 74499953255, 1118421967520, 17907571955927, 304619809031127, 5486197279305911, 104289196264058030, 2086706157642260387, 43838287730208552691, 964790364323910060691
Offset: 0

Views

Author

Alois P. Heinz, Feb 20 2019

Keywords

Crossrefs

Column k=1 of A306506.

Programs

  • Maple
    a:= proc(n) option remember; `if`(n<5, [0$2, 1, 4, 19][n+1],
          (2*(n^3-8*n^2+20*n-14)*a(n-1)-(n-4)*(n-1)*(n^2-5*n+7)*
           a(n-2)-(n-2)*(n^2-7*n+13)*a(n-3)+(n^4-12*n^3+53*n^2
           -102*n+71)*a(n-4)+(n-4)*(n^2-5*n+7)*a(n-5))/(n^2-7*n+13))
        end:
    seq(a(n), n=0..23);
  • Mathematica
    a[n_] := n! - Sum[Sum[(-1)^k (i-k)! Binomial[2i-k, k], {k, 0, i}],
         {i, 0, n}];
    a /@ Range[0, 23] (* Jean-François Alcover, May 03 2021, after Vaclav Kotesovec in A078480 *)

Formula

a(n) = n! - A078480(n).