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-10 of 14 results. Next

A060351 If the binary expansion of n has k bits, let S be the subset of [k-1] such that i is in S if the i-th bit of n is a 1 (with the first bit being the least significant bit); a(n) is the number of permutations of [k] with descent set S.

Original entry on oeis.org

1, 1, 1, 1, 1, 2, 2, 1, 1, 3, 5, 3, 3, 5, 3, 1, 1, 4, 9, 6, 9, 16, 11, 4, 4, 11, 16, 9, 6, 9, 4, 1, 1, 5, 14, 10, 19, 35, 26, 10, 14, 40, 61, 35, 26, 40, 19, 5, 5, 19, 40, 26, 35, 61, 40, 14, 10, 26, 35, 19, 10, 14, 5, 1, 1
Offset: 0

Views

Author

Mike Zabrocki, Mar 31 2001

Keywords

Comments

a(n) is the number of permutations in the symmetric group S_k such that n = 2^(k-1) + the sum of 2^(i-1), where i is a descent of the permutation and k = number of digits in the binary expansion of n.
If n=4m then a(n)-a(n+1)+a(n+2)-a(n+3) = 0. This follows from Theorem 10 of my paper arXiv:0801.0072v1. E.g., a(20)-a(21)+a(22)-a(23) = 9-16+11-4 = 0. - Vladimir Shevelev, Jan 07 2008
Denote by {n,k} the number of permutations of {0,1,...n} such that the binary expansion of k with n-1 digits (the expansion is allowed to begin with 0's) indicates a fixed distribution of "up"(1) and "down"(0) points. The numbers {n,k} are called "up-down coefficients" of permutations, since they have many similar properties to binomial coefficients C(n,k) (see Shevelev et al. references). The sequence lists the rows numbers {n,k} as a triangle read by rows (see example). - Vladimir Shevelev, Feb 13 2014

Examples

			Interpreted as a triangle:
  1;
  1;
  1, 1;
  1, 2, 2, 1;
  1, 3, 5, 3, 3, 5, 3, 1;
  1, 4, 9, 6, 9, 16, 11, 4, 4, 11, 16, 9, 6, 9, 4, 1;
  1, 5, 14, 10, 19, 35, 26, 10, 14, 40, 61, 35, 26, 40, 19, 5, 5, 19, 40, 26, 35, 61, 40, 14, 10, 26, 35, 19, 10, 14, 5, 1;
  ...
From _Vladimir Shevelev_, Feb 13 2014: (Start)
Consider {4,2} (see comments). k=010 (4-1 binary digits).
So {4,2} is the number of down-up-down permutations of {1,2,3,4}. We have 5 such permutations (2,1,4,3),(3,1,4,2),(3,2,4,1),(4,1,3,2) and (4,2,3,1). Thus {4,2}=5.
Over rows, the sequence has the form:
  {0,0}
  {1,0}
  {2,0} {2,1}
  {3,0} {3,1} {3,2} {3,3}
  {4,0} {4,1} {4,2} {4,3} {4,4} {4,5} {4,6} {4,7}
  ...
such that the i-th row contains ceiling(2^(i-1)) entries with row sum i!, i>=0.
(End)
The binary expansion of n=11 is 1011, which has k=4 digits. Of the first k-1=3 bits, starting from the least significant bit on the right, the first and second are 1, so S={1,2}. The a(11)=3 permutations of [k]={1,2,3,4} with descent set S={1,2} are {3,2,1,4}, {4,2,1,3}, and {4,3,1,2}. - _Danny Rorabaugh_, Apr 02 2015
		

References

  • I. Niven, A combinatorial problem of finite sequences, Nieuw Arch. Wisk. (3) 16 (1968), 116-123.

Crossrefs

Row sums give A000142.
Row lengths give A011782(n).
T(n,n) gives A335308.

Programs

  • Maple
    ct := proc(k) option remember; local i,out,n; if k=0 then RETURN(1); fi; n := floor(evalf(log[2](k)))+1; if k=2^n or k=2^(n+1)-1 then RETURN(1); fi; out := 0; for i from 1 to n do if irem(iquo(k, 2^(i-1)), 2) = 1 and irem(iquo(2*k,2^(i-1)),2) =0 then out := out+(n-1)!/(i-1)!/(n-i)!* ct(floor(irem(k,2^(i-1))+2^(i-2)))*ct(iquo(k,2^i)); fi; od; out; end: seq(ct(i),i=0..64);
    # second Maple program:
    b:= proc(u, o, t) option remember; expand(`if`(u+o=0, 1,
          add(b(u-j, o+j-1, t+1)*x^floor(2^(t-1)), j=1..u)+
          add(b(u+j-1, o-j, t+1), j=1..o)))
        end:
    T:= n-> (p-> seq(coeff(p, x, i), i=0..degree(p)))(b(n, 0$2)):
    seq(T(n), n=0..7);  # Alois P. Heinz, Sep 08 2020
    # third Maple program:
    b:= proc(u, o, t) option remember; `if`(u+o=0, `if`(t=0, 1, 0),
         `if`(irem(t, 2)=0, add(b(u-j, o+j-1, iquo(t, 2)), j=1..u),
          add(b(u+j-1, o-j, iquo(t, 2)), j=1..o)))
        end:
    T:= (n, k)-> b(n, 0, 2*k):
    seq(seq(T(n, k), k=0..ceil(2^(n-1))-1), n=0..7);  # Alois P. Heinz, Sep 12 2020
  • Mathematica
    <Wouter Meeussen, Jan 30 2012 *)
    upDown[n_, k_] := upDown[n, k] = Module[{t, m}, t = Flatten[ Reverse[ Position[ Reverse[ IntegerDigits[k, 2]], 1]]]; m = Length[t]; (-1)^m + Sum[upDown[t[[j]], k - 2^(t[[j]]-1)]*Binomial[n, t[[j]]], {j, 1, m}]]; Table[upDown[n, k], {n, 1, 7}, {k, 0, 2^(n-1)-1}] // Flatten (* Jean-François Alcover, Jul 16 2017, after Vladimir Shevelev *)
    P[n_, x_] := P[n, x] = (1/(1-x^2^(n-1)))(Product[1-x^2^k, {k, 0, (n-1)}] + Sum[Binomial[n, i] Product[1-x^2^k, {k, i, n-1}] x^2^(i-1) P[i, x], {i, 1, n-1}]) // Simplify; P[1, ] = 1; Table[CoefficientList[P[n, x], x], {n, 1, 7}] // Flatten (* _Jean-François Alcover, Sep 06 2018, after Vladimir Shevelev *)

Formula

{n+1,2*k} + {n+1,2*k+1} = (n+1)*{n,k},
{n+2,4*k} + {n+2,4*k+2} = {n+2, 4*k+1} + {n+2,4*k+1} + {n+2,4*k+3} = (n+2)*(n+1)/2 * {n,k}, etc.
Sum_{i=0..2^r-1} {n,i} = n*(n-1)*...*(n-r+1).
For n >= 1, 0 <= k < 2^(n-1), {n,k} <= {n,r_n}, where r_n=(2^n-2)/3, if n is odd, r_n=(2^n-1)/3, if n is even.
Equality holds iff k=r_n or 2^(n-1)-r_n-1, which corresponds the case of alternating permutations. De Bruijn mentioned that Niven knew the latter result, but he never published this statement. A proof can be found in the Shevelev and Spilker reference (Section 5).
Many other equalities, recursions and unequalities can be found in Shevelev and Shevelev-Spilker references. - Vladimir Shevelev, Feb 13 2014

Extensions

Definition corrected by Julian Gilbey, Jul 26 2007
T(0,0)=1 prepended by Alois P. Heinz, Sep 08 2020

A262372 Number T(n,k) of ordered pairs (p,q) of permutations of [n] with equal up-down signatures and p(1)=q(1)=k if n>0; triangle T(n,k), n>=0, 0<=k<=n, read by rows.

Original entry on oeis.org

1, 0, 1, 0, 1, 1, 0, 2, 2, 2, 0, 10, 8, 8, 10, 0, 88, 68, 64, 68, 88, 0, 1216, 952, 852, 852, 952, 1216, 0, 24176, 19312, 17008, 16328, 17008, 19312, 24176, 0, 654424, 533544, 467696, 438496, 438496, 467696, 533544, 654424
Offset: 0

Views

Author

Alois P. Heinz, Sep 20 2015

Keywords

Examples

			T(4,1) = 10: (1234,1234), (1243,1243), (1243,1342), (1324,1324), (1324,1423), (1342,1243), (1342,1342), (1423,1324), (1423,1423), (1432,1432).
T(4,2) = 8: (2134,2134), (2143,2143), (2314,2314), (2314,2413), (2341,2341), (2413,2314), (2413,2413), (2431,2431).
T(4,3) = 8: (3124,3124), (3142,3142), (3142,3241), (3214,3214), (3241,3142), (3241,3241), (3412,3412), (3421,3421).
T(4,4) = 10: (4123,4123), (4132,4132), (4132,4231), (4213,4213), (4213,4312), (4231,4132), (4231,4231), (4312,4213), (4312,4312), (4321,4321).
Triangle T(n,k) begins:
  1
  0,     1;
  0,     1,     1;
  0,     2,     2,     2;
  0,    10,     8,     8,    10;
  0,    88,    68,    64,    68,    88;
  0,  1216,   952,   852,   852,   952,  1216;
  0, 24176, 19312, 17008, 16328, 17008, 19312, 24176;
  ...
		

Crossrefs

Main diagonal and column k=1 give A060350(n-1) for n>0.
Row sums give A262234.
T(2n,n) gives A262379.

Programs

  • Maple
    b:= proc(u, o, h) option remember; `if`(u+o=0, 1,
          add(add(b(u-j, o+j-1, h+i-1), i=1..u+o-h), j=1..u)+
          add(add(b(u+j-1, o-j, h-i), i=1..h), j=1..o))
        end:
    T:= (n, k)-> `if`(k=0, `if`(n=0, 1, 0), b(k-1, n-k, n-k)):
    seq(seq(T(n, k), k=0..n), n=0..10);
  • Mathematica
    b[u_, o_, h_] := b[u, o, h] = If[u + o == 0, 1,
      Sum[b[u - j, o + j - 1, h + i - 1], {i, 1, u + o - h}, {j, 1, u}] +
      Sum[b[u + j - 1, o - j, h - i], {i, 1, h}, {j, 1, o}]];
    T[n_, k_] := If[k == 0, If[n == 0, 1, 0], b[k - 1, n - k, n - k]];
    Table[T[n, k], {n, 0, 10}, {k, 0, n}] // Flatten (* Jean-François Alcover, May 05 2019, after Alois P. Heinz *)

A334622 A(n,k) is the sum of the k-th powers of the descent set statistics for permutations of [n]; square array A(n,k), n>=0, k>=0, read by antidiagonals.

Original entry on oeis.org

1, 1, 1, 1, 1, 2, 1, 1, 2, 4, 1, 1, 2, 6, 8, 1, 1, 2, 10, 24, 16, 1, 1, 2, 18, 88, 120, 32, 1, 1, 2, 34, 360, 1216, 720, 64, 1, 1, 2, 66, 1576, 14460, 24176, 5040, 128, 1, 1, 2, 130, 7224, 190216, 994680, 654424, 40320, 256, 1, 1, 2, 258, 34168, 2675100, 46479536, 109021500, 23136128, 362880, 512
Offset: 0

Views

Author

Alois P. Heinz, Sep 09 2020

Keywords

Examples

			Square array A(n,k) begins:
   1,   1,     1,      1,        1,          1,            1, ...
   1,   1,     1,      1,        1,          1,            1, ...
   2,   2,     2,      2,        2,          2,            2, ...
   4,   6,    10,     18,       34,         66,          130, ...
   8,  24,    88,    360,     1576,       7224,        34168, ...
  16, 120,  1216,  14460,   190216,    2675100,     39333016, ...
  32, 720, 24176, 994680, 46479536, 2368873800, 128235838496, ...
  ...
		

Crossrefs

Columns k=0-4 give: A011782, A000142, A060350, A291902, A291903.
Rows n=0+1, 2-3 give: A000012, A007395(k+1), A052548(k+1).
Main diagonal gives A334623.

Programs

  • Maple
    b:= proc(u, o, t) option remember; expand(`if`(u+o=0, 1,
          add(b(u-j, o+j-1, t+1)*x^floor(2^(t-1)), j=1..u)+
          add(b(u+j-1, o-j, t+1), j=1..o)))
        end:
    A:= (n, k)-> (p-> add(coeff(p, x, i)^k, i=0..degree(p)))(b(n, 0$2)):
    seq(seq(A(n, d-n), n=0..d), d=0..10);
  • Mathematica
    b[u_, o_, t_] := b[u, o, t] = Expand[If[u + o == 0, 1,
        Sum[b[u - j, o + j - 1, t + 1] x^Floor[2^(t - 1)], {j, 1, u}] +
        Sum[b[u + j - 1, o - j, t + 1], {j, 1, o}]]];
    A[n_, k_] := Function[p, Sum[Coefficient[p, x, i]^k, {i, 0, Exponent[p, x]}]][b[n, 0, 0]];
    Table[Table[A[n, d - n], {n, 0, d}], {d, 0, 10}] // Flatten (* Jean-François Alcover, Dec 20 2020, after Alois P. Heinz *)

Formula

A(n,k) = Sum_{j=0..ceiling(2^(n-1))-1} A060351(n,j)^k.

A259465 Triangle read by rows: enumerates pairs of amicable permutations by rises.

Original entry on oeis.org

1, 1, 1, 1, 1, 8, 1, 1, 43, 43, 1, 1, 194, 826, 194, 1, 1, 803, 11284, 11284, 803, 1, 1, 3184, 127905, 392244, 127905, 3184, 1, 1, 12367, 1297629, 10258067, 10258067, 1297629, 12367, 1, 1, 47606, 12295720, 224702858, 561134638, 224702858, 12295720, 47606, 1
Offset: 0

Views

Author

N. J. A. Sloane, Jun 30 2015, following a suggestion from L. Carlitz, Nov 30 1975

Keywords

Examples

			Triangle begins:
  1;
  1;
  1,     1;
  1,     8,       1;
  1,    43,      43,        1;
  1,   194,     826,      194,        1;
  1,   803,   11284,    11284,      803,       1;
  1,  3184,  127905,   392244,   127905,    3184,     1;
  1, 12367, 1297629, 10258067, 10258067, 1297629, 12367, 1;
  ...
		

Crossrefs

Row sums give A060350.

Programs

  • Maple
    b:= proc(u, o, h) option remember; `if`(u+o=0, 1, expand(
          add(add(b(u-j, o+j-1, h+i-1), i=1..u+o-h)*x, j=1..u)+
          add(add(b(u+j-1, o-j, h-i), i=1..h), j=1..o)))
        end:
    T:= n-> (p-> seq(coeff(p, x, i), i=0..degree(p)))(b(0, n$2)):
    seq(T(n), n=0..10);  # Alois P. Heinz, Jul 02 2015
  • Mathematica
    b[u_, o_, h_] := b[u, o, h] = If[u+o == 0, 1, Expand[Sum[Sum[b[u-j, o+j-1, h+i-1], {i, 1, u+o-h}]*x, {j, 1, u}] + Sum[Sum[b[u+j-1, o-j, h-i], {i, 1, h}], {j, 1, o}]]]; T[n_] := Function[p, Table[Coefficient[p, x, i], {i, 0, Exponent[p, x]}]][b[0, n, n]]; Table[T[n], {n, 0, 10}] // Flatten (* Jean-François Alcover, Feb 12 2016, after Alois P. Heinz *)

Extensions

More terms from Alois P. Heinz, Jul 02 2015

A262234 Number of ordered pairs (p,q) of permutations of [n] with equal up-down signatures and p(1)=q(1) if n>0.

Original entry on oeis.org

1, 1, 2, 6, 36, 376, 6040, 137320, 4188320, 164844064, 8129435904, 490812707456, 35601674684160, 3054648986802432, 305980722047302144, 35383891435049320960, 4678354778386866393088, 701273672223926436540416, 118292442535368693562662912
Offset: 0

Views

Author

Alois P. Heinz, Sep 15 2015

Keywords

Examples

			a(1) = 1: (1,1).
a(2) = 2: (12,12), (21,21).
a(3) = 6: (123,123), (132,132), (213,213), (231,231), (312,312), (321,321).
a(4) = 36: (1234,1234), (1243,1243), (1243,1342), (1324,1324), (1324,1423), (1342,1243), (1342,1342), (1423,1324), (1423,1423), (1432,1432), (2134,2134), (2143,2143), (2314,2314), (2314,2413), (2341,2341), (2413,2314), (2413,2413), (2431,2431), (3124,3124), (3142,3142), (3142,3241), (3214,3214), (3241,3142), (3241,3241), (3412,3412), (3421,3421), (4123,4123), (4132,4132), (4132,4231), (4213,4213), (4213,4312), (4231,4132), (4231,4231), (4312,4213), (4312,4312), (4321,4321).
		

Crossrefs

Row sums of A262372.

Programs

  • Maple
    b:= proc(u, o, h) option remember; `if`(u+o=0, 1,
          add(add(b(u-j, o+j-1, h+i-1), i=1..u+o-h), j=1..u)+
          add(add(b(u+j-1, o-j, h-i), i=1..h), j=1..o))
        end:
    a:= n-> `if`(n=0, 1, add(b(j-1, n-j, n-j), j=1..n)):
    seq(a(n), n=0..20);
  • Mathematica
    b[u_, o_, h_] := b[u, o, h] = If[u + o == 0, 1, Sum[Sum[b[u - j, o + j - 1, h + i - 1], {i, 1, u + o - h}], {j, 1, u}] + Sum[Sum[b[u + j - 1, o - j, h - i], {i, 1, h}], {j, 1, o}]];
    a[n_] := If[n == 0, 1, Sum[b[j - 1, n - j, n - j], {j, 1, n}]];
    a /@ Range[0, 20] (* Jean-François Alcover, Dec 19 2020, after Alois P. Heinz *)

Formula

a(n) ~ c * d^n * n!^2 / n, where d = 0.552406011965766199179395470003589240257321... and c = 2.1899604476932970295731699544312... - Vaclav Kotesovec, Sep 18 2020

A262233 Number of ordered pairs (p,q) of permutations of [n] with equal up-down signatures and p(1)=1 if n>0.

Original entry on oeis.org

1, 1, 1, 3, 20, 220, 3648, 84616, 2617696, 104112576, 5176135040, 314525766016, 22934467613184, 1976385358538240, 198701625441195520, 23050434113386398720, 3055967615464202301440, 459172688072604359835648, 77616824553405653653094400
Offset: 0

Views

Author

Alois P. Heinz, Sep 15 2015

Keywords

Examples

			a(1) = 1: (1,1).
a(2) = 1: (12,12).
a(3) = 3: (123,123), (132,132), (132,231).
a(4) = 20: (1234,1234), (1243,1243), (1243,1342), (1243,2341), (1324,1324), (1324,1423), (1324,2314), (1324,2413), (1324,3412), (1342,1243), (1342,1342), (1342,2341), (1423,1324), (1423,1423), (1423,2314), (1423,2413), (1423,3412), (1432,1432), (1432,2431), (1432,3421).
		

Crossrefs

Programs

  • Maple
    b:= proc(u, o, h) option remember; `if`(u+o=0, 1,
          add(add(b(u-j, o+j-1, h+i-1), i=1..u+o-h), j=1..u)+
          add(add(b(u+j-1, o-j, h-i), i=1..h), j=1..o))
        end:
    a:= n-> `if`(n=0, 1, add(b(j-1, n-j, n-1), j=1..n)):
    seq(a(n), n=0..20);
  • Mathematica
    b[u_, o_, h_] := b[u, o, h] = If[u + o == 0, 1,
       Sum[Sum[b[u - j, o + j - 1, h + i - 1], {i, 1, u + o - h}], {j, 1, u}]+
       Sum[Sum[b[u + j - 1, o - j, h - i], {i, 1, h}], {j, 1, o}]];
    a[n_] := If[n == 0, 1, Sum[b[j - 1, n - j, n - 1], {j, 1, n}]];
    a /@ Range[0, 20] (* Jean-François Alcover, Jan 02 2021, after Alois P. Heinz *)

Formula

a(n) ~ c * d^n * n!^2 / n, where d = 0.552406011965766199179395470003589240257321... and c = 1.48557711044485933585341072480938... - Vaclav Kotesovec, Sep 18 2020

A262241 Number of ordered pairs (p,q) of permutations of [n] with complementary up-down signatures and p(1)=q(1) if n>0.

Original entry on oeis.org

1, 1, 0, 2, 12, 144, 2456, 58376, 1836064, 73967072, 3714221440, 227511703296, 16699185465088, 1446996011652864, 146157945571218944, 17023105015524481536, 2264733463688117325824, 341323210761171895406592, 57851227793596711612702720
Offset: 0

Views

Author

Alois P. Heinz, Sep 15 2015

Keywords

Comments

1 < p(1) = q(1) < n for n > 1.

Examples

			a(1) = 1: (1,1).
a(2) = 0.
a(3) = 2: (213,231), (231,213).
a(4) = 12: (2134,2431), (2143,2314), (2143,2413), (2314,2143), (2413,2143), (2431,2134), (3124,3421), (3142,3412), (3241,3412), (3412,3142), (3412,3241), (3421,3124).
		

Crossrefs

Programs

  • Maple
    b:= proc(u, o, h) option remember; `if`(u+o=0, 1,
          add(add(b(u-j, o+j-1, h-i), i=1..h), j=1..u)+
          add(add(b(u+j-1, o-j, h+i-1), i=1..u+o-h), j=1..o))
        end:
    a:= n-> `if`(n=0, 1, add(b(j-1, n-j, n-j), j=1..n)):
    seq(a(n), n=0..20);
  • Mathematica
    b[u_, o_, h_] := b[u, o, h] = If[u + o == 0, 1,
         Sum[Sum[b[u - j, o + j - 1, h - i], {i, h}], {j, u}] +
         Sum[Sum[b[u + j - 1, o - j, h + i - 1], {i, u + o - h}], {j, o}]];
    a[n_] := If[n == 0, 1, Sum[b[j - 1, n - j, n - j], {j, n}]];
    Table[a[n], {n, 0, 20}] (* Jean-François Alcover, Aug 30 2021, after Alois P. Heinz *)

A291903 Sums of the fourth powers of the descent set statistics for permutations on n elements.

Original entry on oeis.org

1, 1, 2, 34, 1576, 190216, 46479536, 21246061600, 16505196258944, 20569621110703360, 39048520577674054912, 108556407221350072075840, 427386074980323385950161920, 2317659324414032887611600999424, 16904848426143946143993568391307264, 162490636486997482412425606460112242944, 2021898321663894965658036079204603050491904
Offset: 0

Views

Author

Richard Ehrenborg, Sep 05 2017

Keywords

Examples

			For n=4, we have a(4) = 1^4 + 3^4 + 5^4 + 3^4 + 3^4 + 5^4 + 3^4 + 1^4 = 1576.
		

Crossrefs

Column k=4 of A334622.

Formula

a(n) = Sum_{j=0..ceiling(2^(n-1))-1} A060351(n,j)^4. - Alois P. Heinz, Sep 15 2020

Extensions

a(0)=1 prepended by Alois P. Heinz, Sep 09 2020

A335845 Irregular triangular array T(n,k) read by rows. Row n gives the number of permutations of {1,2,...,n} whose descent set is S for each subset S of {1,2,...,n-1} ordered lexicographically within the rows.

Original entry on oeis.org

1, 1, 1, 1, 1, 2, 2, 1, 1, 3, 5, 3, 3, 5, 3, 1, 1, 4, 9, 9, 4, 6, 16, 11, 11, 16, 6, 4, 9, 9, 4, 1, 1, 5, 14, 19, 14, 5, 10, 35, 40, 19, 26, 61, 40, 26, 35, 10, 10, 35, 26, 40, 61, 26, 19, 40, 35, 10, 5, 14, 19, 14, 5, 1, 1, 6, 20, 34, 34, 20, 6, 15, 64, 99
Offset: 0

Views

Author

Geoffrey Critzer, Jun 26 2020

Keywords

Comments

Row lengths are A011782(n).
Every row begins and ends with a 1 because there is exactly 1 n-permutation whose descent set is the empty set and there is exactly 1 n-permutation whose descent set is {1,2,...,n-1}, namely the identity permutation and its reverse.

Examples

			T(5,5) = 6 because there are 6 permutations of [5] whose descent set is {1,2}: (3,2,1,4,5), (4,2,1,3,5), (4,3,1,2,5), (5,2,1,3,4), (5,3,1,2,4), (5,4,1,2,3).
Triangle T(n,k) begins:
  1;
  1;
  1, 1;
  1, 2, 2, 1;
  1, 3, 5, 3, 3, 5,  3,  1;
  1, 4, 9, 9, 4, 6, 16, 11, 11, 16, 6, 4, 9, 9, 4, 1;
  ...
		

Crossrefs

Row sums give A000142.

Programs

  • Maple
    T:= proc(n) option remember; local b, i, l; l:=
          map(x-> add(2^(i-1), i=x), [seq(combinat[choose](
                  [$1..n-1], i)[], i=0..n-1)]); h(0):=0;
          for i to nops(l) do h(l[i]):= (i-1) od: b:=
          proc(u, o, t) option remember; `if`(u+o=0, x^h(t),
            add(b(u-j, o+j-1, t), j=1..u)+
            add(b(u+j-1, o-j, t+2^(u+o-1)), j=1..o))
          end; (p->
          seq(coeff(p, x, i), i=0..degree(p)))(b(n, 0$2))
        end:
    seq(T(n), n=0..7);  # Alois P. Heinz, Feb 03 2023
  • Mathematica
    f[list_] := (-1)^(Length[list] + 1) Apply[Multinomial, list];
    Table[g[S_] :=Abs[Total[Map[f, Map[Differences,Map[Prepend[#, 0] &, Map[Append[#, n] &, Subsets[S]]]]]]];Map[g, Subsets[Range[n - 1]]], {n, 1, 5}] // Grid

Extensions

T(0,0)=1 prepended by Alois P. Heinz, Sep 08 2020

A137782 a(n) = the number of permutations (p(1), p(2), ..., p(n)) of (1,2,...,n) where, for each k (2 <= k <= n), the sign of (p(k) - p(k-1)) equals the sign of (p(n+2-k) - p(n+1-k)).

Original entry on oeis.org

1, 1, 2, 2, 12, 24, 200, 540, 6160, 21616, 306432, 1310880, 22338624, 113017696, 2245983168, 13108918368, 297761967360, 1969736890624, 50332737128960, 372125016868608, 10565549532009472, 86337114225206784, 2696451226217269248, 24132714802787013632
Offset: 0

Views

Author

Leroy Quet, Feb 10 2008

Keywords

Comments

Number of order n permutations whose descent set is invariant w.r.t. the function f(x) = n-x. - Max Alekseyev, May 06 2009

Examples

			Consider the permutation (for n = 7): 3,6,7,5,1,2,4.
The signs of the differences between adjacent terms form the sequence: ++--++, which has reflective symmetry. So this permutation, among others, is counted when n = 7.
		

Crossrefs

Cf. A137783.

Programs

  • Maple
    b:= proc(u, o, h) option remember; `if`(u+o=0, 1,
          add(add(b(u-j, o+j-1, h+i-1), i=1..u+o-h), j=1..u)+
          add(add(b(u+j-1, o-j, h-i), i=1..h), j=1..o))
        end:
    a:= proc(n) option remember; local r;
         `if`(irem(n, 2, 'r')=0, b(0, r$2)*binomial(n, r),
          add(add(binomial(j-1, i)*binomial(n-j, r-i)*
          b(r-i, i, n-j-r+i), i=0..min(j-1, r)), j=1..n))
        end:
    seq(a(n), n=0..30);  # Alois P. Heinz, Sep 15 2015
  • Mathematica
    b[u_, o_, h_] := b[u, o, h] = If[u+o == 0, 1, Sum[Sum[b[u-j, o+j-1, h+i-1], {i, 1, u+o-h}], {j, 1, u}] + Sum[Sum[b[u+j-1, o-j, h-i], {i, 1, h}], {j, 1, o}]];
    a[n_] := a[n] = Module[{r = Quotient[n, 2]}, If[Mod[n, 2] == 0, b[0, r, r]*Binomial[n, r], Sum[Sum[Binomial[j-1, i]*Binomial[n-j, r-i]*b[r-i, i, n-j-r+i], {i, 0, Min[j-1, r]}], {j, 1, n}]]];
    Table[a[n], {n, 0, 30}] (* Jean-François Alcover, May 13 2019, after Alois P. Heinz *)
  • PARI
    { a(n) = local(r,u,c,t); r=0; forvec(v=vector(n-1,i,[2*i==n,1]), u=sum(i=1,#v,v[i]); c=sum(i=1,(n-1)\2,!v[i]&&!v[n-i]); t=[0]; for(i=1,#v,if(v[i],t=concat(t,[i]))); r += (-1)^u * 2^c * n! \ prod(i=2,#t,(t[i]-t[i-1])!) \ (n-t[ #t])! ); (-1)^(n+1)*r } \\ Max Alekseyev, May 06 2009

Formula

a(2n) = A000984(n)*A060350(n). - Max Alekseyev, Apr 23 2009

Extensions

First 8 terms calculated by Olivier Gérard
Extended by Max Alekseyev, May 06 2009
a(0), a(22) from Alois P. Heinz, Jul 02 2015
a(23) from Alois P. Heinz, Sep 15 2015
Showing 1-10 of 14 results. Next