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