|
|
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
|
|
|
FORMULA
|
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
|
|
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)! ) );
(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
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|