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.

Previous Showing 71-73 of 73 results.

A346492 Triangle read by rows: T(n,k) is the number of permutations of length n such that the minimum over maximum difference of elements in cycles is exactly k; 0 <= k < n.

Original entry on oeis.org

1, 1, 1, 4, 0, 2, 15, 2, 1, 6, 76, 8, 8, 4, 24, 455, 40, 40, 45, 20, 120, 3186, 244, 246, 254, 270, 120, 720, 25487, 1729, 1728, 1757, 1849, 1890, 840, 5040, 229384, 13948, 13960, 14096, 14540, 14792, 15120, 6720, 40320
Offset: 1

Views

Author

Peter Kagey, Jul 19 2021

Keywords

Comments

First column is A002467.

Examples

			The minimum over maximum difference of elements in cycles of the permutation (421)(53), written in cycle notation, is 2. The first cycle has maximum difference of 4-1=3, the second cycle has a maximum difference of 5-3=2, and the minimum of these is min(3,2) = 2.
The permutations whose minimum over maximum difference of elements in cycles is 0 are precisely those with a fixed point.
n\k |      0     1     2     3     4     5     6    7     8
----+--------------------------------------------------------
  1 |      1
  2 |      1     1
  3 |      4     0     2
  4 |     15     2     1     6
  5 |     76     8     8     4    24
  6 |    455    40    40    45    20   120
  7 |   3186   244   246   254   270   120   720
  8 |  25487  1729  1728  1757  1849  1890   840 5040
  9 | 229384 13948 13960 14096 14540 14792 15120 6720 40320
		

Crossrefs

Cf. A002467.

A367198 T(n, k) = Sum_{m = 0..n-1} Stirling1(m+1, k)*binomial(n, m)*(-1)^(n + k), where "Stirling1" are the signed Stirling numbers of the first kind.

Original entry on oeis.org

1, 1, 2, 4, 6, 3, 15, 30, 18, 4, 76, 165, 125, 40, 5, 455, 1075, 930, 380, 75, 6, 3186, 8015, 7679, 3675, 945, 126, 7, 25487, 67536, 70042, 37688, 11550, 2044, 196, 8, 229384, 634935, 702372, 414078, 144417, 30870, 3990, 288, 9, 2293839, 6591943, 7696245, 4886390, 1885065, 463092, 73080, 7200, 405, 10
Offset: 1

Views

Author

Thomas Scheuerle, Nov 10 2023

Keywords

Comments

To use the unsigned Stirling numbers rewrite the formula as: T(n, k) = Sum_{m = 0..n-1} abs(Stirling1(m+1, k))*binomial(n, m)*(-1)^(1+m+n). Replacing in this formula Stirling1 (A008275) by Stirling2 (A048993) one obtains a shifted version of A321331.

Examples

			Triangle begins:
    1;
    1,    2;
    4,    6,   3;
   15,   30,  18,   4;
   76,  165, 125,  40,  5;
  455, 1075, 930, 380, 75, 6;
		

Crossrefs

Cf. A002411, A002467 (first column), A000027 (main diagonal), A008275.
Cf. A180191(n+1) (row sums), A321331 (variant with Stirling2).

Programs

  • Maple
    T := (n, k) -> local m; add(Stirling1(m+1, k)*binomial(n, m)*(-1)^(n + k), m = 0..n-1): seq(seq(T(n, k), k = 1..n), n = 1..9);  # Peter Luschny, Nov 10 2023
  • PARI
    T(n,k) = sum(m=0, n-1, stirling(m+1, k)*binomial(n, m)*(-1)^(n+k))

Formula

T(n+1, n) = n^2*(n+1)/2 = A002411(n).
T(n, n-2) = 6*T(n-1, n-3) - 15*T(n-2, n-4) + 20*T(n-3, n-5) - 15*T(n-4, n-6) + 6*T(n-5, n-7) - T(n-6, n-8), for n > 8.
T(n, n-k) = (-1)^k*Sum_{m=0..n-1} Stirling1(m+1, n-k)*binomial(n, m).

A378100 Number of involutions in the symmetric group S_n with at least one fixed point.

Original entry on oeis.org

0, 1, 1, 4, 7, 26, 61, 232, 659, 2620, 8551, 35696, 129757, 568504, 2255345, 10349536, 44179711, 211799312, 962854399, 4809701440, 23103935021, 119952692896, 605135328337, 3257843882624, 17175956434375, 95680443760576, 525079354619951, 3020676745975552
Offset: 0

Views

Author

Maniru Ibrahim, Nov 16 2024

Keywords

Comments

In other words, a(n) is the number of involutions in S_n that are not derangements.

Examples

			a(4) = 7: (1,2)(3)(4), (1,3)(2)(4), (1,4)(2)(3), (1)(2,3)(4), (1)(2,4)(3), (1)(2)(3,4), (1)(2)(3)(4).
		

Crossrefs

Cf. A000085 (involutions), A000166 (derangements), A002467 (permutations with a fixed point), A099174, A123023 (involutions that are derangements).

Programs

  • Maple
    a := proc(n)
        local k, total, deranged;
        total := add(factorial(n)/(factorial(n-2*k)*2^k*factorial(k)), k=0..floor(n/2));
        if mod(n, 2) = 0 then
            deranged := factorial(n)/(2^(n/2)*factorial(n/2));
        else
            deranged := 0;
        end if;
        return total - deranged;
    end proc:
    seq(a(n), n=1..20);
    # second Maple program:
    a:= proc(n) option remember; `if`(n<4, [0, 1$2, 4][n+1],
          a(n-1)+(2*n-3)*a(n-2)-(n-2)*(a(n-3)+(n-3)*a(n-4)))
        end:
    seq(a(n), n=0..27);  # Alois P. Heinz, Nov 24 2024
  • Mathematica
    a[n_] := Module[{total, deranged},
      total = Sum[n! / ((n - 2 k)! * 2^k * k!), {k, 0, Floor[n/2]}];
      deranged = If[EvenQ[n], n! / (2^(n/2) * (n/2)!), 0];
      total - deranged
    ];
    Table[a[n], {n, 1, 20}]
  • PARI
    my(x='x+O('x^30)); Vec(serlaplace(exp(x+x^2/2)-exp(x^2/2))) \\ Joerg Arndt, Nov 27 2024
  • Python
    from math import factorial
    def a(n):
        total = sum(factorial(n) // (factorial(n - 2 * k) * 2**k * factorial(k))
                    for k in range(n // 2 + 1))
        deranged = factorial(n) // (2**(n // 2) * factorial(n // 2)) if n % 2 == 0 else 0
        return total - deranged
    print([a(n) for n in range(1, 21)])
    

Formula

a(n) = Sum_{k=0..floor(n/2)} n! / ((n-2k)! * 2^k * k!) - (n! / (2^(n/2) * (n/2)!) * (1 - (n mod 2))).
a(n) = A000085(n) - A123023(n).
a(n) = A000085(n) for odd n.
From Alois P. Heinz, Nov 24 2024: (Start)
E.g.f.: exp(x*(2+x)/2)-exp(x^2/2).
a(n) = Sum_{k=1..n} A099174(n,k). (End)
Previous Showing 71-73 of 73 results.