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

A062868 Number of permutations of degree n with barycenter 0.

Original entry on oeis.org

1, 1, 2, 4, 14, 46, 282, 1394, 12658, 83122, 985730, 8012962, 116597538, 1127575970, 19410377378, 217492266658, 4320408974978, 55023200887938, 1238467679662722, 17665859065690754, 444247724347355554, 7015393325151055906, 194912434760367113570, 3375509056735963889634
Offset: 0

Views

Author

Olivier Gérard, Jun 26 2001

Keywords

Comments

The barycenter or signcenter of a permutation is the sum of the signs of the difference between initial and final positions of the objects.

Examples

			(4,1,3,5,2) has difference (3,-1,0,1,-3) and signs (1,-1,0,1,-1) with total 0.
		

Crossrefs

Column k=0 of A062866 or of A062867.

Programs

  • Maple
    b:= proc(s, t) option remember; (n-> `if`(abs(t)>n, 0, `if`(n=0, 1,
          add(b(s minus {j}, t+signum(n-j)), j=s))))(nops(s))
        end:
    a:= n-> b({$1..n}, 0):
    seq(a(n), n=0..14);  # Alois P. Heinz, Jul 31 2018
  • Mathematica
    E1[n_ /; n >= 0, 0] = 1;
    E1[n_, k_] /; k < 0 || k > n = 0;
    E1[n_, k_] := E1[n, k] = (n-k) E1[n-1, k-1] + (k+1) E1[n-1, k];
    b[n_] := Sum[(-1)^(n-k) E1[n+k, n] Binomial[2n, n-k], {k, 0, n}];
    a[n_] := Sum[Binomial[n, n-2k] b[k], {k, 0, n/2}];
    a /@ Range[0, 150] (* Jean-François Alcover, Oct 29 2020, after Peter Luschny in A320337 *)

Formula

a(n) = Sum_{k=0..floor(n/2)} binomial(n, n-2*k)*A320337(k). - Maxwell Jiang, Dec 19 2018 (added by editors)
a(n) ~ sqrt(3) * (1 + exp(-2)*(-1)^n) * n^n / exp(n). - Vaclav Kotesovec, Oct 29 2020

Extensions

One more term from Vladeta Jovovic, Jun 28 2001
a(11)-a(14) from Hugo Pfoertner, Sep 23 2004
a(15)-a(18) from R. H. Hardin, Jul 18 2010
a(19)-a(22) from Kyle G Hess, Jul 30 2018
a(0)=1 prepended by Alois P. Heinz, Jul 30 2018
Terms a(23) and beyond from Maxwell Jiang, Dec 19 2018

A062869 Triangle read by rows: For n >= 0, k >= 0, T(n,k) is the number of permutations pi of n such that the total distance Sum_i abs(i-pi(i)) = 2k. Equivalently, k = Sum_i max(i-pi(i),0).

Original entry on oeis.org

1, 1, 1, 1, 1, 2, 3, 1, 3, 7, 9, 4, 1, 4, 12, 24, 35, 24, 20, 1, 5, 18, 46, 93, 137, 148, 136, 100, 36, 1, 6, 25, 76, 187, 366, 591, 744, 884, 832, 716, 360, 252, 1, 7, 33, 115, 327, 765, 1523, 2553, 3696, 4852, 5708, 5892, 5452, 4212, 2844, 1764, 576, 1, 8, 42, 164, 524
Offset: 0

Views

Author

Olivier Gérard, Jun 26 2001

Keywords

Comments

Number of possible values is 1,2,3,5,7,10,13,17,21,... = A033638. Maximum distance divided by 2 is the same minus one, i.e., 0,1,2,4,6,9,12,16,20,... = A002620.
T. Kyle Petersen and Bridget Eileen Tenner proved that T(n,k) is also the number of permutations of n for which the sum of descent differences equals k. - Susanne Wienand, Sep 11 2014

Examples

			Triangle T(n,k) begins:
  1;
  1;
  1, 1;
  1, 2,  3;
  1, 3,  7,  9,   4;
  1, 4, 12, 24,  35,  24,  20;
  1, 5, 18, 46,  93, 137, 148, 136, 100,  36;
  1, 6, 25, 76, 187, 366, 591, 744, 884, 832, 716, 360, 252;
  ...
(4,3,1,2) has distances (3,1,2,2), sum is 8 and there are 3 other permutations of degree 4 with this sum.
		

References

  • D. E. Knuth, The Art of Computer Programming, vol. 3, (1998), page 22 (exercise 28) and page 597 (solution and comments).

Crossrefs

Row sums give A000142.
T(2n,n) gives A072948.
A357329 is a sub-triangle.

Programs

  • Maple
    # The following program yields the entries of the specified row n
    n := 9: with(combinat): P := permute(n): excsum := proc (p) (1/2)*add(abs(p[i]-i), i = 1 .. nops(p)) end proc: f[n] := sort(add(t^excsum(P[j]), j = 1 .. factorial(n))): seq(coeff(f[n], t, j), j = 0 .. floor((1/4)*n^2)); # Emeric Deutsch, Apr 02 2010
    # Maple program using the g.f. given by Guay-Paquey and Petersen:
    g:= proc(h, n) local i, j; j:= irem(h, 2, 'i');
           1-`if`(h=n, 0, (i+1)*z*t^(i+j)/g(h+1, n))
        end:
    T:= n-> (p-> seq(coeff(p, t, k), k=0..degree(p)))
            (coeff(series(1/g(0, n), z, n+1), z, n)):
    seq(T(n), n=0..10);  # Alois P. Heinz, May 02 2014
  • Mathematica
    g[h_, n_] := Module[{i, j}, {i, j} = QuotientRemainder[h, 2]; 1 - If[h == n, 0, (i + 1)*z*t^(i + j)/g[h + 1, n]]]; T[n_] := Function[p, Table[ Coefficient[p, t, k], {k, 0, Exponent[p, t]}]][SeriesCoefficient[ 1/g[0, n], {z, 0, n}]]; Table[T[n], {n, 1, 10}] // Flatten (* Jean-François Alcover, Jan 07 2016, after Alois P. Heinz *)
    f[i_] := If[i == 1, 1, -(i-1)^2 t^(2i - 3) z^2];
    g[i_] := 1 - (2i - 1) t^(i-1) z;
    cf = ContinuedFractionK[f[i], g[i], {i, 1, 5}];
    CoefficientList[#, t]& /@ CoefficientList[cf + O[z]^10, z] // Rest // Flatten (* Jean-François Alcover, Nov 25 2018, after Mathieu Guay-Paquet *)
  • Sage
    # The following Sage program
    # yields the entries of the first n rows
    # as a list of lists
    def get_first_rows(n):
        R, t = PolynomialRing(ZZ, 't').objgen()
        S, z = PowerSeriesRing(R, 'z').objgen()
        gf = S(1).add_bigoh(1)
        for i in srange(n, 0, -1):
            a = (i+1) // 2
            b = i // 2
            gf = 1 / (1 - a * t^b * z * gf)
        return [list(row) for row in gf.shift(-1)]
    # Mathieu Guay-Paquet, Apr 30 2014

Formula

From Mathieu Guay-Paquet, Apr 30 2014: (Start)
G.f.: 1/(1-z/(1-t*z/(1-2*t*z/(1-2*t^2*z/(1-3*t^2*z/(1-3*t^3*z/(1-4*t^3*z/(1-4*t^4*z/(...
This is a continued fraction where the (2i)th numerator is (i+1)*t^i*z, and the (2i+1)st numerator is (i+1)*t^(i+1)*z for i >= 0. The coefficient of z^n gives row n, n >= 1, and the coefficient of t^k gives column k, k >= 0. (End)
From Alois P. Heinz, Oct 02 2022: (Start)
Sum_{k=0..floor(n^2/4)} k * T(n,k) = A005990(n).
Sum_{k=0..floor(n^2/4)} (-1)^k * T(n,k) = A009006(n). (End).

Extensions

T(0,0)=1 prepended by Alois P. Heinz, Oct 03 2022

A062867 Triangle read by rows: entries give numbers of permutations of [1..n] by absolute barycenter.

Original entry on oeis.org

1, 1, 2, 4, 2, 14, 8, 2, 46, 62, 10, 2, 282, 292, 132, 12, 2, 1394, 2578, 784, 268, 14, 2, 12658, 15472, 9718, 1920, 534, 16, 2, 83122, 171662, 69318, 33230, 4470, 1058, 18, 2, 985730, 1282604, 964544, 276044, 107660, 10100, 2096, 20, 2, 8012962, 17465978, 8199268, 4851200, 1022824, 337988, 22396, 4160, 22, 2
Offset: 0

Views

Author

Olivier Gérard, Jun 26 2001

Keywords

Comments

The barycenter or signcenter of a permutation is the sum of the signs of the difference between initial and final positions of the objects.

Examples

			[1], [2], [4, 2], [14, 8, 2], [46, 62, 10, 2], [282, 292, 132, 12, 2], ...
(1,6,2,3,4,5,7) has difference (0,5,-1,-1,-1,-1,0) and signs (0,1,-1,-1,-1,-1,0) with total -3, absolute value is 3. This is one of 268 such permutations of degree 7.
Triangle T(n,k) begins:
       1;
       1;
       2;
       4,       2;
      14,       8,      2;
      46,      62,     10,      2;
     282,     292,    132,     12,      2;
    1394,    2578,    784,    268,     14,     2;
   12658,   15472,   9718,   1920,    534,    16,    2;
   83122,  171662,  69318,  33230,   4470,  1058,   18,  2;
  985730, 1282604, 964544, 276044, 107660, 10100, 2096, 20, 2;
		

Crossrefs

Column k=0 gives A062868.
Row sums give A000142.
Cf. A062866.

Programs

  • Maple
    b:= proc(s, t) option remember; (n-> `if`(n=0, x^t,
          add(b(s minus {j}, t+signum(n-j)), j=s)))(nops(s))
        end:
    T:= n-> (p-> seq(coeff(p, x, i)*`if`(i=0, 1, 2), i=0..degree(p)))(b({$1..n}, 0)):
    seq(T(n), n=0..12);  # Alois P. Heinz, Jul 31 2018
  • Mathematica
    b[s_, t_] := b[s, t] = With[{n = Length[s]}, If[n == 0, x^t, Sum[b[s  ~Complement~ {j}, t + Sign[n - j]], {j, s}]]];
    T[n_] := With[{p = b[Range[n], 0]}, Table[Coefficient[p, x, i]*If[i == 0, 1, 2], {i, 0, Exponent[p, x]}]];
    Table[T[n], {n, 0, 12}] // Flatten (* Jean-François Alcover, Jan 25 2021, after Alois P. Heinz *)

Formula

T(n,0) = A062868(n) = A062866(n,0), T(n,k) = 2 * A062866(n,k) for k>0. - Alois P. Heinz, Jul 31 2018

Extensions

More terms from Vladeta Jovovic, Jun 29 2001

A062870 Number of permutations of degree n with greatest sum of distances.

Original entry on oeis.org

1, 1, 1, 3, 4, 20, 36, 252, 576, 5184, 14400, 158400, 518400, 6739200, 25401600, 381024000, 1625702400, 27636940800, 131681894400, 2501955993600, 13168189440000, 276531978240000, 1593350922240000, 36647071211520000, 229442532802560000, 5736063320064000000
Offset: 0

Views

Author

Olivier Gérard, Jun 26 2001

Keywords

Comments

Number of possible values is 1,2,3,5,7,10,13,17,21,... which I conjecture to be A033638. Maximum distance divided by 2 is the same minus one, i.e., 0,1,2,4,6,9,12,16,20,... which seems to be A002620.

Examples

			(4,3,1,2) has distances (3,1,2,2), sum is 8 and there are 3 other permutations of degree 4 {3, 4, 1, 2}, {3, 4, 2, 1}, {4, 3, 2, 1} with this sum which is the maximum possible.
		

Crossrefs

A007590(n) is the greatest sum of distances for a permutation of degree n. - Dmitry Kamenetsky, Nov 14 2017

Programs

  • Maple
    a:= proc(n) option remember; `if`(n<2, 1+n*(n-1),
          (n*((n-1)^2*(3*n-4)*a(n-2)-4*a(n-1)))/(4*(n-1)*(3*n-7)))
        end:
    seq(a(n), n=0..30);  # Alois P. Heinz, Jan 16 2014
  • Mathematica
    a[n_?EvenQ] := (n/2)!^2; a[n_?OddQ] := n*((n-1)/2)!^2; Table[a[n], {n, 0, 30}] (* Jean-François Alcover, Apr 15 2015 *)
  • PARI
    for(k=0,20,print1((2*k+1)*k!^2","(k+1)!^2",")) \\ Herman Jamke (hermanjamke(AT)fastmail.fm), Dec 27 2007

Formula

a(n) = (n/2)!^2 if n is even else n*((n-1)/2)!^2, cf. A092186. - Conjectured by Vladeta Jovovic, Aug 21 2007; proved (see the link) by Max Alekseyev, Aug 21 2007
a(n) = A062869(n,floor(n^2/4)) for n>=1. - Alois P. Heinz, Oct 02 2022

Extensions

a(10)-a(14) from Hugo Pfoertner, Sep 23 2004
More terms from Herman Jamke (hermanjamke(AT)fastmail.fm), Dec 27 2007

A169934 Number of permutations of 1..n with the number moved left exceeding the number moved right by 2.

Original entry on oeis.org

0, 0, 0, 1, 5, 66, 392, 4859, 34659, 482272, 4099634, 65762489, 653977909, 12026621478, 137361430156, 2862534403223, 36968414699239, 862935261673212, 12440701298168534, 321935664074780549, 5126628962937663529, 145768013651370381026, 2541561479354892816304
Offset: 1

Views

Author

R. H. Hardin, Jul 19 2010

Keywords

Crossrefs

Column k=2 (or k=-2) of A062866.
Equal number moved left and right, see A062868.

Extensions

a(19)-a(20) from Alois P. Heinz, Jul 31 2018
a(21)-a(23) from Alois P. Heinz, Apr 28 2024

A179562 Number of permutations of 1..n with the number moved left exceeding the number moved right by 1.

Original entry on oeis.org

0, 0, 1, 4, 31, 146, 1289, 7736, 85831, 641302, 8732989, 78432212, 1270475155, 13338831858, 250740220345, 3013809363056, 64512904742895, 873589792390382, 20982459271174517, 316070362138732172, 8418423492219771211, 139628838506569935338, 4084524856346911809777
Offset: 1

Views

Author

R. H. Hardin, Jul 19 2010

Keywords

Crossrefs

Column k=1 (or k=-1) of A062866.
Equal number moved left and right, see A062868.

Extensions

a(19)-a(20) from Alois P. Heinz, Jul 31 2018
a(21)-a(23) from Alois P. Heinz, Apr 28 2024

A179564 Number of permutations of 1..n with the number moved left exceeding the number moved right by 3.

Original entry on oeis.org

0, 0, 0, 0, 1, 6, 134, 960, 16615, 138022, 2425600, 23279224, 444500577, 4880181294, 102914967458, 1277238809792, 29767443364523, 412889949481670, 10588965173821348, 162515224089696984, 4560137456338593333, 76773519570724122126, 2343258977445039475014
Offset: 1

Views

Author

R. H. Hardin, Jul 19 2010

Keywords

Crossrefs

Column k=3 (or k=-3) of A062866.
Equal number moved left and right, see A062868.

Extensions

a(19)-a(20) from Alois P. Heinz, Jul 31 2018
a(21)-a(23) from Alois P. Heinz, Apr 28 2024

A179565 Number of permutations of [n] with the number moved left exceeding the number moved right by 4.

Original entry on oeis.org

0, 0, 0, 0, 0, 1, 7, 267, 2235, 53830, 511412, 11370998, 122063526, 2787148807, 33618432005, 817366315013, 10992904020133, 288039183533356, 4284317049630762, 121306011298119784, 1980129988160763368, 60512049675634245013, 1076468156084116242851
Offset: 1

Views

Author

R. H. Hardin, Jul 19 2010

Keywords

Crossrefs

Column k=4 (or k=-4) of A062866.
Equal number moved left and right, see A062868.

Extensions

a(19)-a(20) from Alois P. Heinz, Jul 31 2018
a(21)-a(23) from Alois P. Heinz, Apr 28 2024

A179566 Number of permutations of 1..n with the number moved left exceeding the number moved right by 0 or more.

Original entry on oeis.org

1, 1, 2, 5, 19, 83, 501, 3217, 26489, 223001, 2307265, 23964881, 297799569, 3677298385, 53294334289, 762583317329, 12621599431489, 205355314491969, 3820420692695361, 69655479737261377, 1438574866261997777, 29053167748430247953, 659456581268987396785, 14613762897810470264817
Offset: 0

Views

Author

R. H. Hardin, Jul 19 2010

Keywords

Crossrefs

For equal numbers moved left and right, see A062868.
Cf. A062866.

Formula

a(n) = Sum_{k>=0} A062866(n,k). - Alois P. Heinz, Jul 31 2018

Extensions

a(0) and a(19)-a(20) from Alois P. Heinz, Jul 31 2018
a(21)-a(23) from Alois P. Heinz, Apr 28 2024
Showing 1-9 of 9 results.