cp's OEIS Frontend

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.

A018932 The number of permutations of n cards in which 4 will be the next hit after 2.

This page as a plain text file.
%I A018932 #25 Apr 18 2025 17:44:51
%S A018932 0,3,10,60,408,3120,26640,252000,2620800,29756160,366508800,
%T A018932 4869849600,69455232000,1058593536000,17174123366400,295534407168000,
%U A018932 5377157001216000,103149354147840000,2080771454361600000
%N A018932 The number of permutations of n cards in which 4 will be the next hit after 2.
%C A018932 From the game of Mousetrap.
%H A018932 G. C. Greubel, <a href="/A018932/b018932.txt">Table of n, a(n) for n = 4..450</a>
%H A018932 D. J. Mundfrom, <a href="http://dx.doi.org/10.1006/eujc.1994.1057">A problem of permutations: the Game of "Mousetrap"</a>, Eur. J. Combinat. 15 (1994) 555-560.
%F A018932 a(n) = (n-2)! - 3*(n-3)! + 2*(n-4)! if n > 5. - _R. J. Mathar_, Oct 02 2008
%F A018932 E.g.f.: (x*(1020 - 1290*x + 340*x^2 - 15*x^3 + 3*x^4) + 60*(17 - 30*x + 15*x^2 - 2*x^3)*log(1-x))/360. - _G. C. Greubel_, Feb 21 2019
%p A018932 0,3,seq((n^2-8*n+17)*factorial(n-4),n=6..30); # _Muniru A Asiru_, Feb 22 2019
%t A018932 Join[{0,3}, Table[(n^2-8*n+17)*(n-4)!, {n,6,30}]] (* _G. C. Greubel_, Feb 21 2019 *)
%o A018932 (PARI) for(n=4,30, print1(if(n==4, 0, if(n==5, 3, (n^2-8*n+17)*(n-4)!)), ", ")) \\ _G. C. Greubel_, Feb 21 2019
%o A018932 (Magma) [0,3] cat [(n^2-8*n+17)*Factorial(n-4): n in [6..30]]; // _G. C. Greubel_, Feb 21 2019
%o A018932 (Sage) [0,3] + [(n^2-8*n+17)*factorial(n-4) for n in (6..30)] # _G. C. Greubel_, Feb 21 2019
%o A018932 (GAP) Concatenation([0,3], List([6..30], n-> (n^2-8*n+17)*Factorial(n-4) )); # _G. C. Greubel_, Feb 21 2019
%Y A018932 Cf. A002468.
%K A018932 nonn
%O A018932 4,2
%A A018932 _N. J. A. Sloane_
%E A018932 Offset changed to 4, more terms, better definition and link from _R. J. Mathar_, Oct 02 2008