OFFSET
2,3
REFERENCES
D. E. Knuth: The Art of Computer Programming, Volume 4, Combinatorial Algorithms, Volume 4A, Enumeration and Backtracking. Pre-fascicle 2B, A draft of section 7.2.1.2: Generating all permutations. Available online; see link.
LINKS
Vincenzo Librandi, Table of n, a(n) for n = 2..200
FORMULA
a(2)=0, a(n) = n*a(n-1)+(n-1)*(n-2)/2 for n>=3 c = limit n--> infinity a(n)/n! = 0.35914091422952261768 = e/2-1, a(n) = floor [c*n! - (n-1)/2] for n>=2
E.g.f.: (2-exp(x)*(x^2-2*x+2))/(2*(x-1)). - Vaclav Kotesovec, Oct 21 2012
MATHEMATICA
Transpose[NestList[{First[#]+1, (First[#]+1)Last[#]+(First[#](First[#]-1))/2}&, {2, 0}, 20]][[2]] (* Harvey P. Dale, Feb 27 2012 *)
Rest[Rest[CoefficientList[Series[(2-Exp[x]*(x^2-2*x+2))/(2*(x-1)), {x, 0, 20}], x]*Range[0, 20]!]] (* Vaclav Kotesovec, Oct 21 2012 *)
PROG
FORTRAN program available at Pfoertner link.
CROSSREFS
KEYWORD
nonn
AUTHOR
Hugo Pfoertner, Jan 25 2003
STATUS
approved