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.

A162974 Triangle read by rows: T(n,k) is the number of derangements of {1,2,...,n} having k cycles of length 2 (0 <= k <= floor(n/2)).

This page as a plain text file.
%I A162974 #20 Sep 18 2024 08:11:40
%S A162974 1,0,0,1,2,0,6,0,3,24,20,0,160,90,0,15,1140,504,210,0,8988,4480,1260,
%T A162974 0,105,80864,41040,9072,2520,0,809856,404460,100800,18900,0,945,
%U A162974 8907480,4447520,1128600,166320,34650,0,106877320,53450496,13347180,2217600
%N A162974 Triangle read by rows: T(n,k) is the number of derangements of {1,2,...,n} having k cycles of length 2 (0 <= k <= floor(n/2)).
%C A162974 Row n has 1 + floor(n/2) entries.
%C A162974 Sum of entries in row n = A000166(n) (the derangement numbers).
%C A162974 T(n,0) = A038205(n).
%C A162974 Sum_{k>=0} k*T(n,k) = A000387(n).
%H A162974 Alois P. Heinz, <a href="/A162974/b162974.txt">Rows n = 0..200, flattened</a>
%F A162974 E.g.f.: G(t,z) = exp(z(tz-z-2)/2)/(1-z).
%e A162974 T(4,2)=3 because we have (12)(34), (13)(24), and (14)(23).
%e A162974 Triangle starts:
%e A162974     1;
%e A162974     0;
%e A162974     0,  1;
%e A162974     2,  0;
%e A162974     6,  0,  3;
%e A162974    24, 20,  0;
%e A162974   160, 90,  0, 15;
%e A162974   ...
%p A162974 G := exp((1/2)*z*(t*z-z-2))/(1-z): Gser := simplify(series(G, z = 0, 16)): for n from 0 to 13 do P[n] := sort(expand(factorial(n)*coeff(Gser, z, n))) end do: for n from 0 to 13 do seq(coeff(P[n], t, j), j = 0 .. floor((1/2)*n)) end do;
%p A162974 # second Maple program:
%p A162974 b:= proc(n) option remember; expand(`if`(n=0, 1, add((j-1)!*
%p A162974       `if`(j=2, x, 1)*b(n-j)*binomial(n-1, j-1), j=2..n)))
%p A162974     end:
%p A162974 T:= n-> (p-> seq(coeff(p, x, i), i=0..n/2))(b(n)):
%p A162974 seq(T(n), n=0..14);  # _Alois P. Heinz_, Jan 27 2022
%t A162974 b[n_] := b[n] = Expand[If[n == 0, 1, Sum[(j - 1)!*If[j == 2, x, 1]*b[n - j]*Binomial[n - 1, j - 1], {j, 2, n}]]];
%t A162974 T[n_] := With[{p = b[n]}, Table[Coefficient[p, x, i], {i, 0, n/2}]];
%t A162974 Table[T[n], {n, 0, 14}] // Flatten (* _Jean-François Alcover_, Sep 17 2024, after _Alois P. Heinz_ *)
%Y A162974 Cf. A000166, A000387, A038205, A114320.
%Y A162974 T(2n,n) gives A001147.
%Y A162974 T(2n+3,n) gives A000906(n) = 2*A000457(n).
%K A162974 nonn,tabf
%O A162974 0,5
%A A162974 _Emeric Deutsch_, Jul 22 2009