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.

This page as a plain text file.
%I A306511 #13 May 03 2021 07:14:40
%S A306511 0,0,1,4,19,99,603,4248,34115,307875,3085203,33993870,408482695,
%T A306511 5316309607,74499953255,1118421967520,17907571955927,304619809031127,
%U A306511 5486197279305911,104289196264058030,2086706157642260387,43838287730208552691,964790364323910060691
%N A306511 Number of permutations p of [n] having at least one index i with |p(i)-i| = 1.
%H A306511 Alois P. Heinz, <a href="/A306511/b306511.txt">Table of n, a(n) for n = 0..450</a>
%H A306511 Wikipedia, <a href="https://en.wikipedia.org/wiki/Permutation">Permutation</a>
%F A306511 a(n) = n! - A078480(n).
%p A306511 a:= proc(n) option remember; `if`(n<5, [0$2, 1, 4, 19][n+1],
%p A306511       (2*(n^3-8*n^2+20*n-14)*a(n-1)-(n-4)*(n-1)*(n^2-5*n+7)*
%p A306511        a(n-2)-(n-2)*(n^2-7*n+13)*a(n-3)+(n^4-12*n^3+53*n^2
%p A306511        -102*n+71)*a(n-4)+(n-4)*(n^2-5*n+7)*a(n-5))/(n^2-7*n+13))
%p A306511     end:
%p A306511 seq(a(n), n=0..23);
%t A306511 a[n_] := n! - Sum[Sum[(-1)^k (i-k)! Binomial[2i-k, k], {k, 0, i}],
%t A306511      {i, 0, n}];
%t A306511 a /@ Range[0, 23] (* _Jean-François Alcover_, May 03 2021, after _Vaclav Kotesovec_ in A078480 *)
%Y A306511 Column k=1 of A306506.
%Y A306511 Cf. A000142, A078480, A180191.
%K A306511 nonn
%O A306511 0,4
%A A306511 _Alois P. Heinz_, Feb 20 2019