OFFSET
1,2
COMMENTS
Equivalently, a(n) is the number of cycles in all self-inverse permutations of {1,2,...,n}.
LINKS
Alois P. Heinz, Table of n, a(n) for n = 1..300
FORMULA
E.g.f.: B(A(x)) where A(x) = x +x^2/2 and B(x) = x*exp(x).
EXAMPLE
a(3) = 9 because the self-inverse permutations of [3] are (given in their cycle notation): (1)(2)(3), (1)(2,3), (2)(1,3), (3)(1,2) and there are 9 cycles in all.
MAPLE
A:= x-> x*(x+2)/2:
B:= x-> x*exp(x):
a:= n-> n! *coeff(series(B(A(x)), x, n+1), x, n):
seq(a(n), n=1..30); # Alois P. Heinz, May 01 2011
# second Maple program:
a:= proc(n) option remember; `if`(n<5, [0, 1, 3, 9, 28][n+1],
(n*(n-5)*a(n-1)+n*(n-1)*(n-3)*a(n-2))/((n-1)*(n-4)))
end:
seq(a(n), n=1..30); # Alois P. Heinz, Feb 10 2014
MATHEMATICA
a= x+x^2/2; Drop[Range[0, 20]! CoefficientList[Series[a Exp[a], {x, 0, 20}], x], 1]
CROSSREFS
KEYWORD
nonn
AUTHOR
Geoffrey Critzer, May 01 2011
STATUS
approved