The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 Hints (Greetings from The On-Line Encyclopedia of Integer Sequences!)
 A018934 From the game of Mousetrap. 4

%I

%S 0,0,0,2,8,42,256,1810,14568,131642,1320128,14551074,174879880,

%T 2276108362,31894886208,478775722802,7664993150696,130369025763930,

%U 2347604596782208,44619881467365442,892659329531868168,18750556523491299434,412601744979927877760,9491630163800726992722

%N From the game of Mousetrap.

%C Number of permutations p of [n] such that p(k) = k+2 for exactly one k in the range 0<k<n-1. - _Vladeta Jovovic_, Nov 30 2007

%H Daniel J. Mundfrom, <a href="http://dx.doi.org/10.1006/eujc.1994.1057">A problem in permutations: the game of `Mousetrap'</a>, European J. Combin. 15 (1994), no. 6, 555-560.

%F a(n) = (n-2)*A055790(n-2). E.g.f.: 2*x*exp(-x)/(1-x)^3. - _Vladeta Jovovic_, Nov 30 2007

%F a(n) = floor((n!+1)/e)-floor(((n-2)!+1)/e), n>2. [_Gary Detlefs_, Mar 27 2011]

%F G.f.: (1-x)*x/Q(0) - x, where Q(k)= 1 + x - x*(k+2)/(1 - x*(k+1)/Q(k+1)); (continued fraction). - _Sergei N. Gladkovskii_, Apr 22 2013

%F G.f.: G(0)*x - x, where G(k) = 1 - x^2*(k+1)*(k+2)/(x^2*(k+1)*(k+2) - (1-x*(1+2*k))*(1-x*(3+2*k))/G(k+1) ); (continued fraction). - _Sergei N. Gladkovskii_, Feb 05 2014

%F For n>1, a(n) = (n-1)*A000166(n-1)+(n-2)*A000166(n-2). - _Kevin Long_, Feb 21 2021

%t Join[{0,0},With[{nn=30},CoefficientList[Series[(2x Exp[-x])/(1-x)^3, {x,0,nn}],x] Range[0,nn]!]] (* _Harvey P. Dale_, Nov 16 2013 *)

%o (PARI)

%o C=binomial;

%o a(n)=if(n<=2, 0, n! + sum(k=1,n, (-1)^k * ( C(n-1,k)+C(n-2,k-1) )*(n-k)! ) );

%o /* _Joerg Arndt_, Apr 22 2013 */

%o (Sage)

%o def A():

%o a, b, n = 1, 1, 1

%o yield 0

%o while True:

%o yield b - a

%o n += 1

%o a, b = b, (n-2)*a+(n-1)*b

%o A018934 = A()

%o print([next(A018934) for _ in range(24)]) # _Peter Luschny_, Jan 30 2017

%Y Cf. A000166, A002468, A055790.

%K nonn

%O 0,4

%A _N. J. A. Sloane_.

%E More terms from _Vladeta Jovovic_, Nov 30 2007, corrected Jan 25 2008

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.

Last modified April 13 13:24 EDT 2021. Contains 342936 sequences. (Running on oeis4.)