login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A306523 Number of permutations p of [n] having no index i with |p(i)-i| = 2. 3

%I #15 Oct 31 2021 09:35:00

%S 1,1,2,3,9,34,176,1106,8241,70371,676098,7204713,84252233,1072010712,

%T 14738107136,217656602456,3435793029849,57721548509705,

%U 1028183730411650,19354550056977555,383876766917923073,8001053425278668706,174828593537337033648,3996207024319062050994

%N Number of permutations p of [n] having no index i with |p(i)-i| = 2.

%H Alois P. Heinz, <a href="/A306523/b306523.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! - A306524(n).

%e a(3) = 3: 123, 132, 213.

%e a(4) = 9: 1234, 1243, 1324, 2134, 2143, 2341, 4123, 4231, 4321.

%e a(5) = 34: 12345, 12354, 12435, 13245, 13254, 13452, 15234, 15342, 15432, 21345, 21354, 21435, 23415, 23451, 25314, 25341, 25431, 41235, 41352, 42315, 42351, 43215, 43251, 45231, 45312, 51234, 51342, 51432, 52314, 52341, 52431, 53214, 53241, 53412.

%t b[s_, k_] := b[s, k] = With[{n = Length[s]}, If[n == 0, 1, Sum[If[Abs[i-n] == k, 0, b[s~Complement~{i}, k]], {i, s}]]];

%t A[n_, k_] := If[k >= n, n!, b[Range[n], k]];

%t a[n_] := A[n, 2];

%t Table[Print[n, " ", a[n]]; a[n], {n, 0, 23}] (* _Jean-François Alcover_, Oct 31 2021, after _Alois P. Heinz_ in A306512 *)

%Y Column k=2 of A306512.

%Y Cf. A000142, A306524.

%K nonn

%O 0,3

%A _Alois P. Heinz_, Feb 21 2019

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 16 12:52 EDT 2024. Contains 371711 sequences. (Running on oeis4.)