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

A306512 Number A(n,k) of permutations p of [n] having no index i with |p(i)-i| = k; square array A(n,k), n>=0, k>=0, read by antidiagonals.

Original entry on oeis.org

1, 1, 0, 1, 1, 1, 1, 1, 1, 2, 1, 1, 2, 2, 9, 1, 1, 2, 3, 5, 44, 1, 1, 2, 6, 9, 21, 265, 1, 1, 2, 6, 14, 34, 117, 1854, 1, 1, 2, 6, 24, 53, 176, 792, 14833, 1, 1, 2, 6, 24, 78, 265, 1106, 6205, 133496, 1, 1, 2, 6, 24, 120, 362, 1554, 8241, 55005, 1334961
Offset: 0

Views

Author

Alois P. Heinz, Feb 20 2019

Keywords

Examples

			A(4,0) = 9: 2143, 2341, 2413, 3142, 3412, 3421, 4123, 4312, 4321.
A(4,1) = 5: 1234, 1432, 3214, 3412, 4231.
A(4,2) = 9: 1234, 1243, 1324, 2134, 2143, 2341, 4123, 4231, 4321.
Square array A(n,k) begins:
     1,   1,    1,    1,    1,    1,    1,    1, ...
     0,   1,    1,    1,    1,    1,    1,    1, ...
     1,   1,    2,    2,    2,    2,    2,    2, ...
     2,   2,    3,    6,    6,    6,    6,    6, ...
     9,   5,    9,   14,   24,   24,   24,   24, ...
    44,  21,   34,   53,   78,  120,  120,  120, ...
   265, 117,  176,  265,  362,  504,  720,  720, ...
  1854, 792, 1106, 1554, 2119, 2790, 3720, 5040, ...
		

Crossrefs

Columns k=0-3 give: A000166, A078480, A306523, A324365.
A(n+2j,n+j) (j=0..5) give: A000142, A001564, A001688, A023043, A023045, A023047.
A(2n,n) gives A306535.
Cf. A306506.

Programs

  • Maple
    A:= proc(n, k) option remember; `if`(k>=n, n!, LinearAlgebra[
          Permanent](Matrix(n, (i, j)-> `if`(abs(i-j)=k, 0, 1))))
        end:
    seq(seq(A(n, d-n), n=0..d), d=0..12);
    # second Maple program:
    b:= proc(s, k) option remember; (n-> `if`(n=0, 1, add(
          `if`(abs(i-n)=k, 0, b(s minus {i}, k)), i=s)))(nops(s))
        end:
    A:= (n, k)-> `if`(k>=n, n!, b({$1..n}, k)):
    seq(seq(A(n, d-n), n=0..d), d=0..12);
  • Mathematica
    A[n_, k_] := If[k > n, n!, Permanent[Table[If[Abs[i-j] == k, 0, 1], {i, 1, n}, {j, 1, n}]]]; A[0, 0] = 1;
    Table[A[n, d-n], {d, 0, 12}, {n, 0, d}] // Flatten (* Jean-François Alcover, Feb 05 2021, from first Maple program *)
    b[s_, k_] := b[s, k] = With[{n = Length[s]}, If[n == 0, 1, Sum[
         If[Abs[i-n] == k, 0, b[s ~Complement~ {i}, k]], {i, s}]]];
    A[n_, k_] := If[k >= n, n!, b[Range@n, k]];
    Table[A[n, d-n], {d, 0, 12}, {n, 0, d}] // Flatten (* Jean-François Alcover, Sep 01 2021, from second Maple program *)

Formula

A(n,k) = n! - A306506(n,k).
A(n,n+i) = n! for i >= 0.

A320582 Number T(n,k) of permutations p of [n] such that |{ j : |p(j)-j| = 1 }| = k; triangle T(n,k), n >= 0, 0 <= k <= n, read by rows.

Original entry on oeis.org

1, 1, 0, 1, 0, 1, 2, 0, 4, 0, 5, 6, 10, 2, 1, 21, 36, 42, 12, 9, 0, 117, 226, 219, 104, 47, 6, 1, 792, 1568, 1472, 800, 328, 64, 16, 0, 6205, 12360, 11596, 6652, 2658, 688, 148, 12, 1, 55005, 109760, 103600, 60840, 24770, 7120, 1560, 200, 25, 0, 543597, 1085560, 1030649, 614420, 255830, 77732, 17750, 2876, 365, 20, 1
Offset: 0

Views

Author

Alois P. Heinz, Jan 23 2019

Keywords

Examples

			T(4,0) = 5: 1234, 1432, 3214, 3412, 4231.
T(4,1) = 6: 2431, 3241, 3421, 4132, 4213, 4312.
T(4,2) = 10: 1243, 1324, 1342, 1423, 2134, 2314, 2413, 3124, 3142, 4321.
T(4,3) = 2: 2341, 4123.
T(4,4) = 1: 2143.
Triangle T(n,k) begins:
      1;
      1,      0;
      1,      0,      1;
      2,      0,      4,     0;
      5,      6,     10,     2,     1;
     21,     36,     42,    12,     9,    0;
    117,    226,    219,   104,    47,    6,    1;
    792,   1568,   1472,   800,   328,   64,   16,   0;
   6205,  12360,  11596,  6652,  2658,  688,  148,  12,  1;
  55005, 109760, 103600, 60840, 24770, 7120, 1560, 200, 25,  0;
  ...
		

Crossrefs

Column k=0 gives A078480.
Row sums give A000142.
Main diagonal gives A059841.

Programs

  • Maple
    b:= proc(s) option remember; expand((n-> `if`(n=0, 1, add(
         `if`(abs(n-j)=1, x, 1)*b(s minus {j}), j=s)))(nops(s)))
        end:
    T:= n-> (p-> seq(coeff(p, x, i), i=0..n))(b({$1..n})):
    seq(T(n), n=0..12);
  • Mathematica
    b[s_] := b[s] = Expand[With[{n = Length[s]}, If[n==0, 1, Sum[
         If[Abs[n-j]==1, x, 1]*b[s~Complement~{j}], {j, s}]]]];
    T[n_] := PadRight[CoefficientList[b[Range[n]], x], n+1];
    T /@ Range[0, 12] // Flatten (* Jean-François Alcover, Feb 09 2021, after Alois P. Heinz *)

Formula

Sum_{k=1..n} k * T(n,k) = A052582(n-1) for n > 0.
Sum_{k=0..n} (k+1) * T(n,k) = A082033(n-1) for n > 0.

A127548 O.g.f.: Sum_{n>=0} n!*(x/(1+x)^2)^n.

Original entry on oeis.org

1, 1, 0, 1, 4, 19, 112, 771, 6088, 54213, 537392, 5867925, 69975308, 904788263, 12607819040, 188341689287, 3002539594128, 50878366664393, 913161208490016, 17304836525709097, 345279674107957524, 7235298537356113339
Offset: 0

Views

Author

Vladeta Jovovic, Jun 27 2007

Keywords

Comments

a(n+1) = inverse binomial transform of A013999 = Sum_{k=0..n} binomial(n,k)*(-1)^(n-k)*A013999(k). - Emanuele Munarini, Jul 01 2013

Crossrefs

Programs

  • Maple
    A127548 := proc(n) if n = 0 then 1 ; else add(factorial(s)*(-1)^(n-s)*binomial(s+n-1,2*s-1),s=1..n) ; fi ; end: for n from 0 to 20 do printf("%d,",A127548(n)) ; od ; # R. J. Mathar, Jul 13 2007
  • Mathematica
    nn = 21; CoefficientList[Series[Sum[n!*(x/(1 + x)^2)^n, {n, 0, nn}], {x, 0, nn}], x] (* Michael De Vlieger, Sep 04 2016 *)
  • Python
    import math
    def binomial(n,m):
        a=1
        for k in range(n-m+1,n+1):
            a *= k
        return a//math.factorial(m)
    def A127548(n):
        if n == 0:
            return 1
        a=0
        for s in range(1,n+1):
            a += (-1)**(n-s)*binomial(s+n-1,2*s-1)*math.factorial(s)
        return a
    for n in range(30):
        print(A127548(n))
    # R. J. Mathar, Oct 20 2009

Formula

a(n) = Sum_{s=1..n} (-1)^(n-s)*s!*C(s+n-1,2s-1) if n>=1, where C(a,b)=binomial(a,b). - R. J. Mathar, Jul 13 2007
G.f.: Q(0) where Q(k) = 1 + (2*k + 1)*x/( (1+x)^2- 2*x*(1+x)^2*(k+1)/(2*x*(k+1) + (1+x)^2/Q(k+1) )); (continued fraction). - Sergei N. Gladkovskii, Mar 08 2013
a(n) = A000271(n) + A000271(n-1). - Peter Bala, Sep 02 2016
a(n) ~ exp(-2) * n!. - Vaclav Kotesovec, Oct 31 2017

Extensions

More terms from R. J. Mathar, Jul 13 2007
More terms from R. J. Mathar, Oct 20 2009

A306511 Number of permutations p of [n] having at least one index i with |p(i)-i| = 1.

Original entry on oeis.org

0, 0, 1, 4, 19, 99, 603, 4248, 34115, 307875, 3085203, 33993870, 408482695, 5316309607, 74499953255, 1118421967520, 17907571955927, 304619809031127, 5486197279305911, 104289196264058030, 2086706157642260387, 43838287730208552691, 964790364323910060691
Offset: 0

Views

Author

Alois P. Heinz, Feb 20 2019

Keywords

Crossrefs

Column k=1 of A306506.

Programs

  • Maple
    a:= proc(n) option remember; `if`(n<5, [0$2, 1, 4, 19][n+1],
          (2*(n^3-8*n^2+20*n-14)*a(n-1)-(n-4)*(n-1)*(n^2-5*n+7)*
           a(n-2)-(n-2)*(n^2-7*n+13)*a(n-3)+(n^4-12*n^3+53*n^2
           -102*n+71)*a(n-4)+(n-4)*(n^2-5*n+7)*a(n-5))/(n^2-7*n+13))
        end:
    seq(a(n), n=0..23);
  • Mathematica
    a[n_] := n! - Sum[Sum[(-1)^k (i-k)! Binomial[2i-k, k], {k, 0, i}],
         {i, 0, n}];
    a /@ Range[0, 23] (* Jean-François Alcover, May 03 2021, after Vaclav Kotesovec in A078480 *)

Formula

a(n) = n! - A078480(n).
Showing 1-4 of 4 results.