login
Number of pairs of consecutive non-fixed points in all permutations of {1,2,...,n}.
0

%I #17 Apr 18 2024 17:42:48

%S 1,6,42,312,2520,22320,216720,2298240,26490240,330220800,4430764800,

%T 63707212800,977642265600,15953627289600,275919291648000,

%U 5042392363008000,97102667870208000,1965528727658496000,41724269440229376000,926935665115299840000

%N Number of pairs of consecutive non-fixed points in all permutations of {1,2,...,n}.

%F a(n) = (n-1)! * (n^2 - 3*n + 3) (n>=2).

%F a(n) = A001564(n-2)*(n-1) for n>=2. - _Anton Zakharov_, Sep 14 2016

%F D-finite with recurrence a(n) +(-n-5)*a(n-1) +(4*n-1)*a(n-2) +3*(-n+3)*a(n-3)=0. - _R. J. Mathar_, Jul 22 2022

%e a(3)=6 because in 123, 132, 213, 231, 312, 321 we have 0+1+1+2+2+0 such pairs.

%p seq(factorial(n-1)*(n^2-3*n+3), n = 2 .. 20);

%t Table[(n-1)!(n^2-3n+3),{n,2,30}] (* _Harvey P. Dale_, Mar 28 2012 *)

%Y Cf. A001564.

%K nonn,easy

%O 2,2

%A _Emeric Deutsch_, Jul 19 2009