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.

Showing 1-5 of 5 results.

A027616 Number of permutations of n elements containing a 2-cycle.

Original entry on oeis.org

0, 0, 1, 3, 9, 45, 285, 1995, 15855, 142695, 1427895, 15706845, 188471745, 2450132685, 34301992725, 514529890875, 8232476226975, 139952095858575, 2519137759913775, 47863617438361725, 957272348112505425, 20102719310362613925, 442259824841726816925, 10171975971359716789275
Offset: 0

Views

Author

Joe Keane (jgk(AT)jgk.org)

Keywords

Crossrefs

Column k=2 of A293211.

Programs

  • Magma
    A027616:= func< n | Factorial(n)*(1- (&+[(-1/2)^j/Factorial(j): j in [0..Floor(n/2)]]) ) >;
    [A027616(n): n in [0..30]]; // G. C. Greubel, Aug 05 2022
    
  • Maple
    S:= series((1-exp(-x^2/2))/(1-x), x, 101):
    seq(coeff(S,x,j)*j!,j=0..100); # Robert Israel, May 12 2016
  • Mathematica
    nn=30; Table[n!,{n,0,nn}]-Range[0,nn]!CoefficientList[Series[Exp[-x^2/2]/(1-x),{x,0,nn}],x]  (* Geoffrey Critzer, Oct 20 2012 *)
  • PARI
    a(n) = n! * (1 - sum(k=0,floor(n/2), (-1)^k / (2^k * k!) ) );
    /* Joerg Arndt, Oct 20 2012 */
    
  • PARI
    N=33; x='x+O('x^N);
    v=Vec( 'a0 + serlaplace( (1-exp(-x^2/2))/(1-x) ) );
    v[1]-='a0;  v
    /* Joerg Arndt, Oct 20 2012 */
    
  • SageMath
    def A027616(n): return factorial(n)*(1-sum((-1/2)^k/factorial(k) for k in (0..(n//2))))
    [A027616(n) for n in (0..30)] # G. C. Greubel, Aug 05 2022

Formula

E.g.f.: (1 - exp(-x^2/2)) / (1-x).
a(n) = n! * ( 1 - Sum_{k=0..floor(n/2)} (-1)^k / (2^k * k!) ).
a(n) + A000266(n) = n!. - Yuval Dekel (dekelyuval(AT)hotmail.com), Nov 09 2003
Limit_{n -> oo} a(n)/n! = 1 - e^(-1/2) = 1 - A092605. - Michel Marcus, Aug 08 2013

Extensions

Added more terms, Geoffrey Critzer, Oct 20 2012

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)).

Original entry on oeis.org

1, 0, 0, 1, 2, 0, 6, 0, 3, 24, 20, 0, 160, 90, 0, 15, 1140, 504, 210, 0, 8988, 4480, 1260, 0, 105, 80864, 41040, 9072, 2520, 0, 809856, 404460, 100800, 18900, 0, 945, 8907480, 4447520, 1128600, 166320, 34650, 0, 106877320, 53450496, 13347180, 2217600
Offset: 0

Views

Author

Emeric Deutsch, Jul 22 2009

Keywords

Comments

Row n has 1 + floor(n/2) entries.
Sum of entries in row n = A000166(n) (the derangement numbers).
T(n,0) = A038205(n).
Sum_{k>=0} k*T(n,k) = A000387(n).

Examples

			T(4,2)=3 because we have (12)(34), (13)(24), and (14)(23).
Triangle starts:
    1;
    0;
    0,  1;
    2,  0;
    6,  0,  3;
   24, 20,  0;
  160, 90,  0, 15;
  ...
		

Crossrefs

T(2n,n) gives A001147.
T(2n+3,n) gives A000906(n) = 2*A000457(n).

Programs

  • Maple
    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;
    # second Maple program:
    b:= proc(n) option remember; expand(`if`(n=0, 1, add((j-1)!*
          `if`(j=2, x, 1)*b(n-j)*binomial(n-1, j-1), j=2..n)))
        end:
    T:= n-> (p-> seq(coeff(p, x, i), i=0..n/2))(b(n)):
    seq(T(n), n=0..14);  # Alois P. Heinz, Jan 27 2022
  • Mathematica
    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[n_] := With[{p = b[n]}, Table[Coefficient[p, x, i], {i, 0, n/2}]];
    Table[T[n], {n, 0, 14}] // Flatten (* Jean-François Alcover, Sep 17 2024, after Alois P. Heinz *)

Formula

E.g.f.: G(t,z) = exp(z(tz-z-2)/2)/(1-z).

A186526 Number T(n,k) of permutations on n elements with exactly k 3-cycles; triangle read by rows.

Original entry on oeis.org

1, 1, 2, 4, 2, 16, 8, 80, 40, 520, 160, 40, 3640, 1120, 280, 29120, 8960, 2240, 259840, 87360, 13440, 2240, 2598400, 873600, 134400, 22400, 28582400, 9609600, 1478400, 246400, 343235200, 114329600, 19219200, 1971200, 246400, 4462057600, 1486284800, 249849600, 25625600, 3203200, 62468806400, 20807987200, 3497894400, 358758400, 44844800, 936987251200, 312344032000, 52019968000, 5829824000, 448448000, 44844800
Offset: 0

Views

Author

Dennis P. Walsh, Feb 23 2011

Keywords

Comments

Triangle T(n,k) with 0<=k<=floor(n/3) gives the number of permutations in the symmetric group Sn that have exactly k cycles of length 3. The sum of T(n,k) over all k equals n!.

Examples

			For n=4 and k=1, T(4,1)=8 since there are 8 permutations on 4 elements with 1 cycle of length 3, namely, (abc)(d), (acb)(d), (abd)(c), (adb)(c), (acd)(b), (adc)(b), (bcd)(a), and (bdc)(a).
Triangle T(n,k) begins:
:     1;
:     1;
:     2;
:     4,    2;
:    16,    8;
:    80,   40;
:   520,  160,   40;
:  3640, 1120,  280;
: 29120, 8960, 2240;
: ...
		

References

  • Arratia, R. and Tavaré, S. (1992). The cycle structure of random permutations. Ann. Probab. 20 1567-1591.

Crossrefs

Programs

  • Maple
    seq(seq(n!*(1/3)^x/x!*sum((-1/3)^j/j!,j=0..(floor(n/3)-x)),x=0..floor(n/3)),n=0..15);
    # second Maple program:
    b:= proc(n) option remember; expand(`if`(n=0, 1, add(b(n-i)*
          `if`(i=3, x, 1)*binomial(n-1, i-1)*(i-1)!, i=1..n)))
        end:
    T:= n-> (p-> seq(coeff(p, x, i), i=0..degree(p)))(b(n)):
    seq(T(n), n=0..15);  # Alois P. Heinz, Sep 25 2016
  • Mathematica
    nn = 8; Range[0, nn]! CoefficientList[
       Series[Exp[x^3/3 (y - 1)]/(1 - x), {x, 0, nn}], {x, y}] // Grid

Formula

T(n,k) = (n!(1/3)^k)/k!*sum((-1/3)^j/j!, j=0..(m-k)) where m=floor(n/3).
E.g.f.: exp(x^3/3*(y-1))/(1-x). - Geoffrey Critzer, Aug 26 2012.

A342381 Triangle read by rows: T(n,k) is the number of symmetries of the n-dimensional hypercube that fix exactly 2*k facets; n,k >= 0.

Original entry on oeis.org

1, 1, 1, 5, 2, 1, 29, 15, 3, 1, 233, 116, 30, 4, 1, 2329, 1165, 290, 50, 5, 1, 27949, 13974, 3495, 580, 75, 6, 1, 391285, 195643, 48909, 8155, 1015, 105, 7, 1, 6260561, 3130280, 782572, 130424, 16310, 1624, 140, 8, 1, 112690097, 56345049, 14086260, 2347716, 293454, 29358, 2436, 180, 9, 1
Offset: 0

Views

Author

Peter Kagey, Mar 09 2021

Keywords

Comments

Equivalently the number of symmetries of the n-dimensional cross-polytope that fix exactly 2*k vertices.
If a facet of the hypercube is fixed, then the opposite facet must also be fixed.

Examples

			Table begins:
n\k |         0        1        2       3      4     5    6   7 8 9
----+--------------------------------------------------------------
  0 |         1
  1 |         1        1
  2 |         5        2        1
  3 |        29       15        3       1
  4 |       233      116       30       4      1
  5 |      2329     1165      290      50      5     1
  6 |     27949    13974     3495     580     75     6    1
  7 |    391285   195643    48909    8155   1015   105    7   1
  8 |   6260561  3130280   782572  130424  16310  1624  140   8 1
  9 | 112690097 56345049 14086260 2347716 293454 29358 2436 180 9 1
For the cube in n=2 dimensions (the square) there is
T(2,2) = 1 symmetry that fixes all 2*2 = 4 sides, namely the identity:
     2
   +---+
  3|   |1;
   +---+
     4
T(2,1) = 2 symmetries that fix 2*1 = 2 sides, namely horizonal/vertical flips:
     4           2
   +---+       +---+
  3|   |1 and 1|   |3;
   +---+       +---+
     2           4
and T(2,0) = 5 symmetries that fix 2*0 = 0 sides, namely rotations or diagonal flips:
     1         4         3         3            1
   +---+     +---+     +---+     +---+        +---+
  2|   |4,  1|   |3,  4|   |2,  2|   |4, and 4|   |2.
   +---+     +---+     +---+     +---+        +---+
     3         2         1         1            3
		

Crossrefs

Columns and diagonals: A000354 (k=0), A161937 (k=1), A028895 (n=k+2).
Row sums are A000165.

Programs

  • PARI
    f(n) = sum(k=0, n, (-1)^(n+k)*binomial(n, k)*k!*2^k); \\ A000354
    T(n, k) = f(n-k)*binomial(n, k); \\ Michel Marcus, Mar 10 2021

Formula

T(n,k) = A114320(2n,k)/A001147(n).
T(n,k) = A000354(n-k)*binomial(n,k).

A237928 Triangular array read by rows. T(n,k) is the number of n-permutations with k cycles of length one or k cycles of length two, n>=0,0<=k<=n.

Original entry on oeis.org

1, 1, 1, 2, 1, 1, 3, 3, 0, 1, 18, 14, 9, 0, 1, 95, 75, 35, 10, 0, 1, 540, 369, 135, 55, 15, 0, 1, 3759, 2800, 1239, 420, 70, 21, 0, 1, 30310, 22980, 10570, 2884, 735, 112, 28, 0, 1, 272817, 202797, 87534, 24780, 6489, 1134, 168, 36, 0, 1
Offset: 0

Views

Author

Geoffrey Critzer, Feb 15 2014

Keywords

Examples

			1,
1,    1,
2,    1,    1,
3,    3,    0,    1,
18,   14,   9,    0,   1,
95,   75,   35,   10,  0,  1,
540,  369,  135,  55,  15, 0,  1,
3759, 2800, 1239, 420, 70, 21, 0, 1
T(3,0)=3 because we have: (1)(2)(3);(1,2,3);(2,1,3)
		

Programs

  • Mathematica
    nn=10;c=Sum[y^n x^(3n)/(2^n*n!^2),{n,0,nn}];Table[Take[(Range[0,nn]!CoefficientList[Series[Exp[y x]Exp[-x]/(1-x)+Exp[y x^2/2]Exp[-x^2/2]/(1-x)-c Exp[-x-x^2/2!]/(1-x),{x,0,nn}],{x,y}])[[n]],n],{n,1,nn}]//Grid

Formula

E.g.f.: A(x,y) + B(x,y) - C(x,y) where A(x,y) is e.g.f. for A008290, B(x,y) is e.g.f. for A114320, and C(x,y) = exp(-x - x^2/2)/(1-x)*Sum_{n>=0}y^n*x^(3n)/(2^n*n!^2).
Showing 1-5 of 5 results.