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

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A018934 From the game of Mousetrap. 4
0, 0, 0, 2, 8, 42, 256, 1810, 14568, 131642, 1320128, 14551074, 174879880, 2276108362, 31894886208, 478775722802, 7664993150696, 130369025763930, 2347604596782208, 44619881467365442, 892659329531868168, 18750556523491299434, 412601744979927877760, 9491630163800726992722 (list; graph; refs; listen; history; text; internal format)
OFFSET

0,4

COMMENTS

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

LINKS

Table of n, a(n) for n=0..23.

Daniel J. Mundfrom, A problem in permutations: the game of 'Mousetrap', European J. Combin. 15 (1994), no. 6, 555-560.

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

For n > 1, a(n) = (n-1)*A000166(n-1) + (n-2)*A000166(n-2). - Kevin Long, Feb 21 2021

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 *)

PROG

(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

CROSSREFS

Cf. A000166, A002468, A055790.

Sequence in context: A133417 A235350 A100327 * A107588 A013999 A130649

Adjacent sequences:  A018931 A018932 A018933 * A018935 A018936 A018937

KEYWORD

nonn,changed

AUTHOR

N. J. A. Sloane

EXTENSIONS

More terms from Vladeta Jovovic, Nov 30 2007, corrected Jan 25 2008

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 May 14 09:14 EDT 2021. Contains 343879 sequences. (Running on oeis4.)