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.

A158243 Derangements with at least one 2-cycle.

This page as a plain text file.
%I A158243 #17 Aug 08 2013 11:34:19
%S A158243 0,0,1,0,3,20,105,714,5845,52632,525105,5777090,69337521,901364100,
%T A158243 12618959353,189284859750,3028559357265,51485499960944,
%U A158243 926738981188065,17608040824708242,352160816656099465,7395377145973453980,162698297211819995241,3742060835955157848110
%N A158243 Derangements with at least one 2-cycle.
%H A158243 Alois P. Heinz, <a href="/A158243/b158243.txt">Table of n, a(n) for n = 0..200</a>
%F A158243 E.g.f.: (1-exp(-x^2/2))*exp(-x)/(1-x).
%F A158243 a(n) ~ n! * (exp(-1)-exp(-3/2)). - _Vaclav Kotesovec_, Jul 30 2013
%e A158243 There is just one derangement of 2 elements, it is a 2-cycle, so a(2)=1. The 2 derangements of 3 elements are cyclic shifts (3-cycles), so a(3)=0. The 9 derangements of 4 elements are (both array and cycle notation):
%e A158243 1: [ 1 0 3 2 ] (0, 1) (2, 3)
%e A158243 2: [ 1 2 3 0 ] (0, 1, 2, 3)
%e A158243 3: [ 1 3 0 2 ] (0, 1, 3, 2)
%e A158243 4: [ 2 0 3 1 ] (0, 2, 3, 1)
%e A158243 5: [ 2 3 0 1 ] (0, 2) (1, 3)
%e A158243 6: [ 2 3 1 0 ] (0, 2, 1, 3)
%e A158243 7: [ 3 0 1 2 ] (0, 3, 2, 1)
%e A158243 8: [ 3 2 0 1 ] (0, 3, 1, 2)
%e A158243 9: [ 3 2 1 0 ] (0, 3) (1, 2)
%e A158243 Of these, three (number 1, 5, and 9) contain a 2-cycle, so a(4)=3.
%p A158243 a:= n-> coeff(series((1-exp(-x^2/2))*exp(-x)/(1-x), x, n+1), x, n)*n!:
%p A158243 seq(a(n), n=0..25); # _Alois P. Heinz_, May 20 2013
%p A158243 # second Maple program:
%p A158243 a:= proc(n) option remember; `if`(n<4, n*(n-1)*(3-n)/2,
%p A158243       ((n-1)*((n-3)*a(n-1) +(n-2)*(a(n-2)
%p A158243       +(n-2)*a(n-3) +(n-3)*a(n-4))))/(n-2))
%p A158243     end:
%p A158243 seq(a(n), n=0..25);  # _Alois P. Heinz_, Aug 08 2013
%t A158243 nn = 21; Rest[ Range[0, nn]! CoefficientList[ Series[(Exp[-x] - Exp[-x - x^2/2])/(1 - x), {x, 0, nn}], x]] (* _Geoffrey Critzer_, May 20 2013 *)
%o A158243 (PARI) N=25; z='x+O('x^N); k=2; v=Vec(serlaplace((1-exp(-z^k/k))* exp(-sum(j=1,k-1,z^j/j))/(1-x))) /* vector starting with index 2 */
%Y A158243 Second row of A145877. Cf. A000166.
%K A158243 nonn
%O A158243 0,5
%A A158243 _Joerg Arndt_, Mar 14 2009