A018934 From the game of Mousetrap.
0, 0, 0, 2, 8, 42, 256, 1810, 14568, 131642, 1320128, 14551074, 174879880, 2276108362, 31894886208, 478775722802, 7664993150696, 130369025763930, 2347604596782208, 44619881467365442, 892659329531868168, 18750556523491299434, 412601744979927877760, 9491630163800726992722
Offset: 0
Keywords
Links
- Daniel J. Mundfrom, A problem in permutations: the game of 'Mousetrap', European J. Combin. 15 (1994), no. 6, 555-560.
Programs
-
Mathematica
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 *)
-
PARI
C=binomial; a(n)=if(n<=2, 0, n! + sum(k=1,n, (-1)^k * ( C(n-1,k)+C(n-2,k-1) )*(n-k)! ) ); /* Joerg Arndt, Apr 22 2013 */
-
Sage
def A(): a, b, n = 1, 1, 1 yield 0 while True: yield b - a n += 1 a, b = b, (n-2)*a+(n-1)*b A018934 = A() print([next(A018934) for in range(24)]) # _Peter Luschny, Jan 30 2017
Formula
From Vladeta Jovovic, Nov 30 2007: (Start)
a(n) = (n-2)*A055790(n-2).
E.g.f.: 2*x*exp(-x)/(1-x)^3. (End)
a(n) = floor((n!+1)/e) - floor(((n-2)!+1)/e), n > 2. - Gary Detlefs, Mar 27 2011
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
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
Extensions
More terms from Vladeta Jovovic, Nov 30 2007, corrected Jan 25 2008
Comments