This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A018934 #48 Apr 30 2021 06:14:36 %S A018934 0,0,0,2,8,42,256,1810,14568,131642,1320128,14551074,174879880, %T A018934 2276108362,31894886208,478775722802,7664993150696,130369025763930, %U A018934 2347604596782208,44619881467365442,892659329531868168,18750556523491299434,412601744979927877760,9491630163800726992722 %N A018934 From the game of Mousetrap. %C A018934 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 A018934 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 A018934 From _Vladeta Jovovic_, Nov 30 2007: (Start) %F A018934 a(n) = (n-2)*A055790(n-2). %F A018934 E.g.f.: 2*x*exp(-x)/(1-x)^3. (End) %F A018934 a(n) = floor((n!+1)/e) - floor(((n-2)!+1)/e), n > 2. - _Gary Detlefs_, Mar 27 2011 %F A018934 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 A018934 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 A018934 For n > 1, a(n) = (n-1)*A000166(n-1) + (n-2)*A000166(n-2). - _Kevin Long_, Feb 21 2021 %t A018934 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 A018934 (PARI) %o A018934 C=binomial; %o A018934 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 A018934 /* _Joerg Arndt_, Apr 22 2013 */ %o A018934 (Sage) %o A018934 def A(): %o A018934 a, b, n = 1, 1, 1 %o A018934 yield 0 %o A018934 while True: %o A018934 yield b - a %o A018934 n += 1 %o A018934 a, b = b, (n-2)*a+(n-1)*b %o A018934 A018934 = A() %o A018934 print([next(A018934) for _ in range(24)]) # _Peter Luschny_, Jan 30 2017 %Y A018934 Cf. A000166, A002468, A055790. %K A018934 nonn %O A018934 0,4 %A A018934 _N. J. A. Sloane_ %E A018934 More terms from _Vladeta Jovovic_, Nov 30 2007, corrected Jan 25 2008