OFFSET
0,4
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..456
FORMULA
a(n) = A186370(n,ceiling(n/2)).
EXAMPLE
a(2) = 1: 12.
a(3) = 3: 132, 231, 321.
a(4) = 7: 1243, 1342, 1432, 2341, 2431, 3421, 4321.
MAPLE
b:= proc(n, k) option remember; `if`(k=0,
`if`(n=0, 1, 0), `if`(k<0 or k>n, 0,
k*b(n-1, k)+b(n-1, k-1)+(n-k+1)*b(n-1, k-2)))
end:
a:= n-> b(n, ceil(n/2)):
seq(a(n), n=0..25);
MATHEMATICA
b[n_, k_] := b[n, k] = If[k == 0,
If[n == 0, 1, 0], If[k < 0 || k > n, 0,
k*b[n-1, k] + b[n-1, k-1] + (n-k+1)*b[n-1, k-2]]];
a[n_] := b[n, Ceiling[n/2]];
Table[a[n], {n, 0, 25}] (* Jean-François Alcover, Aug 31 2021, after Alois P. Heinz *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Alois P. Heinz, Apr 19 2018
STATUS
approved