OFFSET
0,4
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..450
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
KEYWORD
nonn
AUTHOR
Alois P. Heinz, Feb 21 2019
STATUS
approved