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-2 of 2 results.

A306506 Number T(n,k) of permutations p of [n] having at least one index i with |p(i)-i| = k; triangle T(n,k), n>=1, 0<=k<=n-1, read by rows.

Original entry on oeis.org

1, 1, 1, 4, 4, 3, 15, 19, 15, 10, 76, 99, 86, 67, 42, 455, 603, 544, 455, 358, 216, 3186, 4248, 3934, 3486, 2921, 2250, 1320, 25487, 34115, 32079, 29296, 25487, 21514, 16296, 9360, 229384, 307875, 292509, 272064, 245806, 214551, 179058, 133800, 75600
Offset: 1

Views

Author

Alois P. Heinz, Feb 20 2019

Keywords

Comments

T(n,k) is defined for n,k>=0. The triangle contains only the terms with k=n.

Examples

			The 6 permutations p of [3]: 123, 132, 213, 231, 312, 321 have absolute displacement sets {|p(i)-i|, i=1..3}: {0}, {0,1}, {0,1}, {1,2}, {1,2}, {0,2}, respectively. Number 0 occurs four times, 1 occurs four times, and 2 occurs thrice. So row n=3 is [4, 4, 3].
Triangle T(n,k) begins:
      1;
      1,     1;
      4,     4,     3;
     15,    19,    15,    10;
     76,    99,    86,    67,    42;
    455,   603,   544,   455,   358,   216;
   3186,  4248,  3934,  3486,  2921,  2250,  1320;
  25487, 34115, 32079, 29296, 25487, 21514, 16296, 9360;
  ...
		

Crossrefs

Columns k=0-3 give: A002467, A306511, A306524, A324366.
T(n+2,n+1) gives A007680 (for n>=0).
T(2n,n) gives A306675.

Programs

  • Maple
    b:= proc(s, d) option remember; (n-> `if`(n=0, add(x^j, j=d),
          add(b(s minus {i}, d union {abs(n-i)}), i=s)))(nops(s))
        end:
    T:= n-> (p-> seq(coeff(p, x, i), i=0..n-1))(b({$1..n}, {})):
    seq(T(n), n=1..9);
    # second Maple program:
    T:= proc(n, k) option remember; n!-LinearAlgebra[Permanent](
          Matrix(n, (i, j)-> `if`(abs(i-j)=k, 0, 1)))
        end:
    seq(seq(T(n, k), k=0..n-1), n=1..9);
  • Mathematica
    T[n_, k_] := n!-Permanent[Table[If[Abs[i-j]==k, 0, 1], {i, 1, n}, {j, 1, n} ]];
    Table[T[n, k], {n, 1, 9}, {k, 0, n-1}] // Flatten (* Jean-François Alcover, May 01 2019, from 2nd Maple program *)

Formula

T(n,k) = n! - A306512(n,k).
T(2n,n) = T(2n,0) = A002467(2n) = (2n)! - A306535(n).

A306535 Number of permutations p of [2n] having no index i with |p(i)-i| = n.

Original entry on oeis.org

1, 1, 9, 265, 14833, 1334961, 176214841, 32071101049, 7697064251745, 2355301661033953, 895014631192902121, 413496759611120779881, 228250211305338670494289, 148362637348470135821287825, 112162153835443422680893595673, 97581073836835777732377428235481
Offset: 0

Views

Author

Alois P. Heinz, Feb 22 2019

Keywords

Comments

Also 0th term of the 2n-th forward differences of n!.

Crossrefs

Programs

  • Maple
    b:= proc(n, k) b(n, k):= `if`(k=0, n!, b(n+1, k-1) -b(n, k-1)) end:
    a:= n-> b(0, 2*n):
    seq(a(n), n=0..23);
    seq(simplify(KummerU(-2*n, -2*n, -1)), n=0..15); # Peter Luschny, May 10 2022
  • Mathematica
    b[n_, k_] := b[n, k] = If[k == 0, n!, b[n + 1, k - 1] - b[n, k - 1]];
    a[n_] := b[0, 2n];
    a /@ Range[0, 23] (* Jean-François Alcover, Apr 02 2021, after Alois P. Heinz *)

Formula

a(n) = A306512(2n,n).
a(n) = (2n)! - A306675(n).
a(n) = KummerU(-2*n, -2*n, -1). - Peter Luschny, May 10 2022
Showing 1-2 of 2 results.