login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A306524
Number of permutations p of [n] having at least one index i with |p(i)-i| = 2.
3
0, 0, 0, 3, 15, 86, 544, 3934, 32079, 292509, 2952702, 32712087, 394749367, 5155010088, 72440184064, 1090017765544, 17486996858151, 297965879586295, 5374189975316350, 102290550351854445, 2049025241258716927, 43089888746430771294, 949172134240270646352
OFFSET
0,4
LINKS
Wikipedia, Permutation
FORMULA
a(n) = n! - A306523(n).
EXAMPLE
a(3) = 3: 231, 312, 321.
a(4) = 15: 1342, 1423, 1432, 2314, 2413, 2431, 3124, 3142, 3214, 3241, 3412, 3421, 4132, 4213, 4312.
MATHEMATICA
T[n_, k_] := n! - Permanent[Table[If[Abs[i-j] == k, 0, 1], {i, 1, n}, {j, 1, n}]];
a[n_] := If[n == 0, 0, T[n, 2]];
Table[Print[n, " ", a[n]]; a[n], {n, 0, 23}] (* Jean-François Alcover, Oct 31 2021, after Alois P. Heinz in A306506 *)
CROSSREFS
Column k=2 of A306506.
Sequence in context: A093615 A191148 A001931 * A355097 A180677 A220875
KEYWORD
nonn
AUTHOR
Alois P. Heinz, Feb 21 2019
STATUS
approved