OFFSET
0,3
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..228
FORMULA
a(n) = A186370(2n,n).
a(n) ~ c * d^n * n! * (n-1)!, where d = 3.4210546206711870249402157940795853513... and c = 0.32723781013647536133280275922604008889245... - Vaclav Kotesovec, Apr 29 2018
EXAMPLE
a(2) = 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(2*n, n):
seq(a(n), n=0..20);
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[2*n, n]; Table[a[n], {n, 0, 20}] (* Jean-François Alcover, May 30 2019, after Alois P. Heinz *)
PROG
(Python)
from sympy.core.cache import cacheit
@cacheit
def b(n, k): return (1 if n==0 else 0) if k==0 else 0 if k<0 or k>n else k*b(n - 1, k) + b(n - 1, k - 1) + (n - k + 1)*b(n - 1, k - 2)
def a(n): return b(2*n, n)
print([a(n) for n in range(31)]) # Indranil Ghosh, Aug 30 2017
CROSSREFS
KEYWORD
nonn
AUTHOR
Alois P. Heinz, Aug 29 2017
STATUS
approved