OFFSET
0,2
LINKS
Robert Israel, Table of n, a(n) for n = 0..224
T. Amdeberhan et al., n-distant permutations more than not, MathOverflow, 2017.
FORMULA
For n>1, a(n) = ( (4*n^2 - 8*n + 1)*a(n-1) + (2*n-2)*(2*n-1)*a(n-2) ) * 2*n/(2*n-3).
(12*n^3+84*n^2+192*n+144)*a(n+1)+(8*n^3+34*n^2-6*n-108)*a(n+2)+(-4*n^3-42*n^2-147*n-162)*a(n+3)+(n+3)*a(n+4) = 0. - Robert Israel, Apr 28 2017
EXAMPLE
For n=2, if the two couples are (1,2) and (a,b), the a(2) = 8 solutions are a12b, a21b, b12a, b21a, 1ab2, 1ba2, 2ab1, 2ba1. - N. J. A. Sloane, Apr 28 2017
MAPLE
f:= rectoproc({(12*x^3+84*x^2+192*x+144)*a(x+1)+(8*x^3+34*x^2-6*x-108)*a(x+2)+(-4*x^3-42*x^2-147*x-162)*a(x+3)+(x+3)*a(x+4), a(0) = 0, a(1) = 2, a(2) = 8, a(3) = 288}, a(x), remember):
map(f, [$0..50]); # Robert Israel, Apr 28 2017
MATHEMATICA
a007060[n_]:=Sum[(-1)^(n - k) Binomial[n, k] Subfactorial[2k], {k, 0, n}]; a[n_]:=If[n<1, 0, a007060[n] + 2n*a007060[n - 1]]; Table[a[n], {n, 0, 50}] (* Indranil Ghosh, Apr 28 2017 *)
PROG
(Python)
from sympy import binomial, subfactorial
def a007060(n): return sum([(-1)**(n - k)*binomial(n, k)*subfactorial(2*k) for k in range(n + 1)])
def a(n): return 0 if n<1 else a007060(n) + 2*n*a007060(n - 1) # Indranil Ghosh, Apr 28 2017
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Max Alekseyev, Apr 28 2017
STATUS
approved