login
This site is supported by donations to The OEIS Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A001540 Number of transpositions needed to generate permutations of length n.
(Formerly M1856 N0734)
2
0, 2, 8, 36, 184, 1110, 7776, 62216, 559952, 5599530, 61594840, 739138092, 9608795208, 134523132926, 2017846993904, 32285551902480, 548854382342176, 9879378882159186, 187708198761024552, 3754163975220491060, 78837443479630312280, 1734423756551866870182 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,2

REFERENCES

N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).

N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

LINKS

Alois P. Heinz, Table of n, a(n) for n = 1..450 (first 100 terms from T. D. Noe)

R. J. Ord-Smith, Generation of permutation sequences: Part 1, Computer J., 13 (1970), 151-155.

Simon Plouffe, Approximations de séries génératrices et quelques conjectures, Dissertation, Université du Québec à Montréal, 1992.

FORMULA

E.g.f.: cosh(x)/(1-x) - exp(x).

Recurrence: a(n) = n*a(n-1) + n - (n mod 2).

a(n) = -1 + n!*Sum{k=0..floor(n/2)} 1/(2*k)! = -1 + round(n! * cosh(1)).

a(n) = |A009179(n)| - 1 = (n-1)*|A009179(n-1) - A009179(n-2)|.

a(n) ~ [cosh(1)*n!] - 1, where [x] is the floor of x. - Simon Plouffe, Nov 28 2018

EXAMPLE

a(5)=-1+5!(1+1/2!+1/4!)=-1+120+60+5=184.

MAPLE

a := n -> (exp(1)*GAMMA(1 + n, 1) + exp(-1)*GAMMA(1 + n, -1))/2 - 1:

seq(simplify(a(n)), n=1..20); # Peter Luschny, Dec 05 2018

MATHEMATICA

With[{nn=20}, Rest[CoefficientList[Series[Cosh[x]/(1-x)-Exp[x], {x, 0, nn}], x]Range[0, nn]!]] (* Harvey P. Dale, Mar 04 2013 *)

PROG

(PARI) a(n)=-1+n!*sum(k=0, floor(n/2), 1/(2*k)!)

(J) a001540=:13 : '<:+/(!y)%!+:i.>:<.-:y' NB. Stephen Makdisi, May 02 2018

(MAGMA) [-1 + (&+[Factorial(n)/Factorial(2*k): k in [0..Floor(n/2)]]): n in [1..20]]; // G. C. Greubel, Nov 28 2018

(Sage) [-1 + factorial(n)*sum(1/factorial(2*k) for k in range(floor((n+2)/2))) for n in (1..20)] # G. C. Greubel, Nov 28 2018

(GAP) a:=[0];; for n in [2..20] do a[n]:=n*a[n-1]+n-(n mod 2); od; a; # Muniru A Asiru, Dec 05 2018

CROSSREFS

Cf. A009179.

Sequence in context: A081958 A316663 A243948 * A129044 A052582 A222468

Adjacent sequences:  A001537 A001538 A001539 * A001541 A001542 A001543

KEYWORD

nonn,easy,nice

AUTHOR

N. J. A. Sloane

EXTENSIONS

Edited by Ralf Stephan, Apr 16 2004

STATUS

approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified August 20 22:45 EDT 2019. Contains 326155 sequences. (Running on oeis4.)