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 10 results.

A242783 Number T(n,k) of permutations of [n] with exactly k (possibly overlapping) occurrences of the consecutive step pattern given by the binary expansion of n, where 1=up and 0=down; triangle T(n,k), n>=0, read by rows.

Original entry on oeis.org

1, 1, 2, 5, 1, 21, 3, 70, 50, 450, 270, 4326, 602, 99, 12, 1, 34944, 5376, 209863, 139714, 13303, 1573632, 1366016, 530432, 158720, 21824925, 15302031, 2715243, 74601, 302273664, 161855232, 14872704, 2854894485, 2600075865, 712988175, 59062275
Offset: 0

Views

Author

Alois P. Heinz, May 22 2014

Keywords

Comments

Sum_{k>0} k*T(n,k) = A249249(n).

Examples

			T(7,3) = 12 because 12 permutations of {1,2,3,4,5,6,7} have exactly 3 (possibly overlapping) occurrences of the consecutive step pattern up, up, up given by the binary expansion of 7 = 111_2: (1,2,3,4,5,7,6), (1,2,3,4,6,7,5), (1,2,3,5,6,7,4), (1,2,4,5,6,7,3), (1,3,4,5,6,7,2), (2,1,3,4,5,6,7), (2,3,4,5,6,7,1), (3,1,2,4,5,6,7), (4,1,2,3,5,6,7), (5,1,2,3,4,6,7), (6,1,2,3,4,5,7), (7,1,2,3,4,5,6).
Triangle T(n,k) begins:
: n\k :       0        1       2       3  4  ...
+-----+------------------------------------
:  0  :       1;
:  1  :       1;                             [row  1 of A008292]
:  2  :       2;                             [row  2 of A008303]
:  3  :       5,       1;                    [row  3 of A162975]
:  4  :      21,       3;                    [row  4 of A242819]
:  5  :      70,      50;                    [row  5 of A227884]
:  6  :     450,     270;                    [row  6 of A242819]
:  7  :    4326,     602,     99,     12, 1; [row  7 of A220183]
:  8  :   34944,    5376;                    [row  8 of A242820]
:  9  :  209863,  139714,  13303;            [row  9 of A230695]
: 10  : 1573632, 1366016, 530432, 158720;    [row 10 of A230797]
		

Crossrefs

Programs

  • Maple
    T:= proc(n) option remember; local b, k, r, h;
          k:= iquo(n,2,'r'); h:= 2^ilog2(n);
          b:= proc(u, o, t) option remember; `if`(u+o=0, 1, expand(
          add(b(u-j, o+j-1, irem(2*t,   h))*`if`(r=0 and t=k, x, 1), j=1..u)+
          add(b(u+j-1, o-j, irem(2*t+1, h))*`if`(r=1 and t=k, x, 1), j=1..o)))
          end: forget(b);
          (p-> seq(coeff(p, x, i), i=0..degree(p)))(b(n, 0, 0))
        end:
    seq(T(n), n=0..15);
  • Mathematica
    T[n_] := T[n] = Module[{b, k, r, h}, {k, r} = QuotientRemainder[n, 2]; h = 2^Floor[Log[2, n]]; b[u_, o_, t_] := b[u, o, t] = If[u + o == 0, 1, Expand[ Sum[b[u - j, o + j - 1, Mod[2*t, h]]*If[r == 0 && t == k, x, 1], {j, 1, u}] + Sum[b[u + j - 1, o - j, Mod[2*t + 1, h]]*If[r == 1 && t == k, x, 1], {j, 1, o}]]]; Function[p, Table[Coefficient[p, x, i], {i, 0, Exponent[p, x]}]][b[n, 0, 0]]]; Table[T[n], {n, 0, 15}] // Flatten (* Jean-François Alcover, Feb 20 2016, after Alois P. Heinz *)

A242819 Number T(n,k) of permutations of [n] with exactly k occurrences of the consecutive step pattern up, down, down; triangle T(n,k), n>=0, 0<=k<=max(0,floor((n-1)/3)), read by rows.

Original entry on oeis.org

1, 1, 2, 6, 21, 3, 90, 30, 450, 270, 2619, 2322, 99, 17334, 20772, 2214, 129114, 195372, 38394, 1067661, 1958337, 591543, 11259, 9713682, 20933154, 8826246, 443718, 96393726, 238789782, 131367258, 12450834, 1036348587, 2900868876, 1989555210, 297195804, 3052323
Offset: 0

Views

Author

Alois P. Heinz, May 23 2014

Keywords

Comments

T(n,k) is also the number of permutations of [n] with exactly k occurrences of the consecutive step pattern up, up, down.
From Vaclav Kotesovec, Aug 26 2014: (Start)
Column k is asymptotic to c(k) * (3*sqrt(3)/(2*Pi))^n * n! * n^k.
Conjecture: c(k) = c(0) * (c(0)-1)^k / (3^k * k!).
Verified numerically:
c(0) = 1.96650951227123825842868... = (1+exp(Pi/sqrt(3)))*sqrt(3)/(2*Pi)
c(1) = 0.63355004986067503869384...
c(2) = 0.10205535828170995196503...
c(3) = 0.01095971939528021798...
c(4) = 0.000882722753946826148...
c(5) = 0.00005687732922585807984...
c(6) = 0.000003054026651631929902...
c(7) = 0.0000001405593242634352116...
c(8) = 0.00000000566049683079281633...
c(9) = 0.0000000002026268159682390665...
c(10)= 0.00000000000652802483581788974...
c(20)= 1.172921625090753...*10^(-28)
c(30)= 1.2959323...*10^(-47)
c(40)= 5.0751...*10^(-68)
(End)

Examples

			T(4,1) = 3: (1,4,3,2), (2,4,3,1), (3,4,2,1).
Triangle T(n,k) begins:
:  0 :       1;
:  1 :       1;
:  2 :       2;
:  3 :       6;
:  4 :      21,        3;
:  5 :      90,       30;
:  6 :     450,      270;
:  7 :    2619,     2322,      99;
:  8 :   17334,    20772,    2214;
:  9 :  129114,   195372,   38394;
: 10 : 1067661,  1958337,  591543,  11259;
: 11 : 9713682, 20933154, 8826246, 443718;
		

Crossrefs

Programs

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

A230797 Number T(n,k) of permutations of [n] with exactly k (possibly overlapping) occurrences of the consecutive step pattern up, down, up, down; triangle T(n,k), n>=0, 0<=k<=max(0,floor((n-3)/2)), read by rows.

Original entry on oeis.org

1, 1, 2, 6, 24, 104, 16, 528, 192, 3296, 1472, 272, 23168, 12800, 4352, 179712, 132352, 42880, 7936, 1573632, 1366016, 530432, 158720, 15207424, 14781952, 7662336, 1911296, 353792, 158880768, 178102272, 101713920, 31813632, 8491008, 1801996288, 2282645504
Offset: 0

Views

Author

Alois P. Heinz, Oct 30 2013

Keywords

Examples

			T(5,1) = 16: 13254, 14253, 14352, 15243, 15342, 23154, 24153, 24351, 25143, 25341, 34152, 34251, 35142, 35241, 45132, 45231.
T(7,2) = 272: 1325476, 1326475, 1326574, ..., 6735241, 6745132, 6745231.
Triangle T(n,k) begins:
:  0 :       1;
:  1 :       1;
:  2 :       2;
:  3 :       6;
:  4 :      24;
:  5 :     104,      16;
:  6 :     528,     192;
:  7 :    3296,    1472,    272;
:  8 :   23168,   12800,   4352;
:  9 :  179712,  132352,  42880,   7936;
: 10 : 1573632, 1366016, 530432, 158720;
		

Crossrefs

Columns k=0-2 give: A177520, A230832, A264077.
T(2n-1,n-2) gives A000182(n) for n>=3.
Row sums give: A000142.

Programs

  • Maple
    b:= proc(u, o, t) option remember; `if`(u+o=0, 1, expand(
          add(b(u-j, o+j-1, [1, 3, 1, 3][t])*`if`(t=4, x, 1), j=1..u)+
          add(b(u+j-1, o-j, [2, 2, 4, 2][t]), j=1..o)))
        end:
    T:= n-> (p-> seq(coeff(p, x, i), i=0..degree(p)))(b(n, 0, 1)):
    seq(T(n), n=0..15);  # Alois P. Heinz, Oct 30 2013
  • Mathematica
    b[u_, o_, t_] := b[u, o, t] = If[u+o == 0, 1, Expand[Sum[b[u-j, o+j-1, {1, 3, 1, 3}[[t]]]*If[t == 4, x, 1], {j, 1, u}] + Sum[b[u+j-1, o-j, {2, 2, 4, 2}[[t]]], {j, 1, o}]]]; T[n_] := Function[p, Table[Coefficient[p, x, i], {i, 0, Exponent[p, x]}]][b[n, 0, 1]]; Table[T[n], {n, 0, 15}] // Flatten (* Jean-François Alcover, Oct 24 2016, after Alois P. Heinz *)

A231384 Number T(n,k) of permutations of [n] with exactly k (possibly overlapping) occurrences of some of the consecutive step patterns UUD, UDU, DUU (U=up, D=down); triangle T(n,k), n>=0, 0<=k<=max(0,n-3), read by rows.

Original entry on oeis.org

1, 1, 2, 6, 13, 11, 39, 52, 29, 158, 233, 230, 99, 674, 1344, 1537, 1118, 367, 3304, 8197, 11208, 10200, 5868, 1543, 19511, 49846, 89657, 95624, 67223, 33118, 7901, 122706, 351946, 724755, 907078, 781827, 492285, 206444, 41759, 834131, 2799536, 6010150
Offset: 0

Views

Author

Alois P. Heinz, Nov 08 2013

Keywords

Examples

			T(4,1) = 11: 1243, 1342, 2341 (UUD), 1324, 1423, 2314, 2413, 3412 (UDU), 2134, 3124, 4123 (DUU).
T(5,0) = 39: 12345, 14325, 15324, ..., 54231, 54312, 54321.
T(5,1) = 52: 12354, 12453, 12543, ..., 53124, 53412, 54123.
T(5,2) = 29: 12435, 12534, 13245, ..., 51243, 51342, 52341.
Triangle T(n,k) begins:
: 0 :     1;
: 1 :     1;
: 2 :     2;
: 3 :     6;
: 4 :    13,    11;
: 5 :    39,    52,    29;
: 6 :   158,   233,   230,    99;
: 7 :   674,  1344,  1537,  1118,   367;
: 8 :  3304,  8197, 11208, 10200,  5868,  1543;
: 9 : 19511, 49846, 89657, 95624, 67223, 33118, 7901;
		

Crossrefs

Columns k=0-2 give: A231385, A231386, A228408.
Diagonal gives: A231410.
Row sums give: A000142.
Cf. A295987.

Programs

  • Maple
    b:= proc(u, o, t) option remember; `if`(u+o=0, 1, expand(
         add(b(u+j-1, o-j, [2, 3, 3, 6, 6, 3][t])*
                 `if`(t in [5, 6], x, 1), j=1..o)+
         add(b(u-j, o+j-1, [4, 5, 5, 4, 4, 5][t])*
                 `if`(t=3, x, 1), j=1..u)))
        end:
    T:= n-> `if`(n=0, 1, (p-> seq(coeff(p, x, i), i=0..degree(p)))
                         (add(b(j-1, n-j, 1), j=1..n))):
    seq(T(n), n=0..12);
  • Mathematica
    b[u_, o_, t_] := b[u, o, t] = If[u+o == 0, 1, Expand[Sum[b[u+j-1, o-j, {2, 3, 3, 6, 6, 3}[[t]]]*If[t == 5 || t == 6, x, 1], {j, 1, o}] + Sum[b[u-j, o+j-1, {4, 5, 5, 4, 4, 5}[[t]]]*If[t == 3, x, 1], {j, 1, u}]]]; T[n_] := If[n == 0, 1, Function[{p},  Table[Coefficient[p, x, i], {i, 0, Exponent[p, x]}]][Sum[b[j-1, n-j, 1], {j, 1, n}]]]; Table[T[n], {n, 0, 12}] // Flatten (* Jean-François Alcover, Feb 05 2015, after Alois P. Heinz *)

A227884 Number T(n,k) of permutations of [n] with exactly k (possibly overlapping) occurrences of the consecutive step pattern up, down, up; triangle T(n,k), n>=0, 0<=k<=max(0,floor(n/2)-1), read by rows.

Original entry on oeis.org

1, 1, 2, 6, 19, 5, 70, 50, 331, 328, 61, 1863, 2154, 1023, 11637, 16751, 10547, 1385, 81110, 144840, 102030, 34900, 635550, 1314149, 1109973, 518607, 50521, 5495339, 12735722, 13046040, 6858598, 1781101, 51590494, 134159743, 157195762, 97348436, 36004400
Offset: 0

Views

Author

Alois P. Heinz, Oct 25 2013

Keywords

Examples

			T(4,1) = 5: 1324, 1423, 2314, 2413, 3412.
Triangle T(n,k) begins:
:  0 :      1;
:  1 :      1;
:  2 :      2;
:  3 :      6;
:  4 :     19,       5;
:  5 :     70,      50;
:  6 :    331,     328,      61;
:  7 :   1863,    2154,    1023;
:  8 :  11637,   16751,   10547,   1385;
:  9 :  81110,  144840,  102030,  34900;
: 10 : 635550, 1314149, 1109973, 518607, 50521;
		

Crossrefs

Columns k=0-1 give: A177477, A227883.
T(2n,n-1) gives A000364(n) for n>=2.
Row sums give: A000142.

Programs

  • Maple
    b:= proc(u, o, t) option remember; `if`(u+o=0, 1, expand(
          add(b(u-j, o+j-1, [1, 3, 1][t]), j=1..u)+
          add(b(u+j-1, o-j, 2)*`if`(t=3, x, 1), j=1..o)))
        end:
    T:= n-> (p-> seq(coeff(p, x, i), i=0..degree(p)))(b(n, 0, 1)):
    seq(T(n), n=0..15);
  • Mathematica
    b[u_, o_, t_] := b[u, o, t] = If[u+o==0, 1, Expand[Sum[b[u-j, o+j-1, {1, 3, 1}[[t]]], {j, 1, u}]+Sum[b[u+j-1, o-j, 2]*If[t==3, x, 1], {j, 1, o}]]];
    T[n_] := Function[p, Table[Coefficient[p, x, i], {i, 0, Exponent[p, x]}]][ b[n, 0, 1]];
    Table[T[n], {n, 0, 15}] // Flatten (* Jean-François Alcover, Mar 29 2017, translated from Maple *)

A230695 Number T(n,k) of permutations of [n] with exactly k (possibly overlapping) occurrences of the consecutive step pattern up, down, down, up; triangle T(n,k), n>=0, 0<=k<=max(0,floor((n-2)/3)), read by rows.

Original entry on oeis.org

1, 1, 2, 6, 24, 109, 11, 588, 132, 3654, 1386, 26125, 13606, 589, 209863, 139714, 13303, 1876502, 1508756, 243542, 18441367, 17429745, 3953529, 92159, 197776850, 214536114, 63334182, 3354454, 2297242583, 2815529811, 1020982869, 93265537, 28739304385
Offset: 0

Views

Author

Alois P. Heinz, Oct 27 2013

Keywords

Examples

			T(5,1) = 11: 14325, 15324, 15423, 24315, 25314, 25413, 34215, 35214, 35412, 45213, 45312.
T(8,2) = 589: 14327658, 14328657, 14328756, ..., 78635412, 78645213, 78645312.
Triangle T(n,k) begins:
:  0 :        1;
:  1 :        1;
:  2 :        2;
:  3 :        6;
:  4 :       24;
:  5 :      109,       11;
:  6 :      588,      132;
:  7 :     3654,     1386;
:  8 :    26125,    13606,     589;
:  9 :   209863,   139714,   13303;
: 10 :  1876502,  1508756,  243542;
: 11 : 18441367, 17429745, 3953529, 92159;
		

Crossrefs

Column k=0 gives: A177519.
Row sums give: A000142.

Programs

  • Maple
    b:= proc(u, o, t) option remember; `if`(u+o=0, 1, expand(
          add(b(u-j, o+j-1, [1, 3, 4, 1][t]), j=1..u)+
          add(b(u+j-1, o-j, 2)*`if`(t=4, x, 1), j=1..o)))
        end:
    T:= n-> (p-> seq(coeff(p, x, i), i=0..degree(p)))(b(n, 0, 1)):
    seq(T(n), n=0..15);
  • Mathematica
    b[u_, o_, t_] := b[u, o, t] = If[u + o == 0, 1, Expand[
         Sum[b[u - j, o + j - 1, {1, 3, 4, 1}[[t]]], {j, 1, u}] +
         Sum[b[u + j - 1, o - j, 2]*If[t == 4, x, 1], {j, 1, o}]]];
    T[n_] := CoefficientList[b[n, 0, 1], x];
    T /@ Range[0, 15] // Flatten (* Jean-François Alcover, Mar 22 2021, after Alois P. Heinz *)

A232933 Number T(n,k) of permutations of [n] with exactly k (possibly overlapping, cyclic wrap-around) occurrences of the consecutive step pattern UDU (U=up, D=down); triangle T(n,k), n>=0, 0<=k<=floor(n/2), read by rows.

Original entry on oeis.org

1, 1, 0, 2, 3, 3, 12, 4, 8, 35, 45, 40, 144, 348, 132, 96, 910, 1862, 1316, 952, 5976, 11600, 14808, 5760, 2176, 39942, 100260, 123606, 63360, 35712, 306570, 919270, 1069910, 910650, 343040, 79360, 2698223, 8427243, 11694397, 10673641, 4477440, 1945856
Offset: 0

Views

Author

Alois P. Heinz, Dec 02 2013

Keywords

Examples

			T(2,1) = 2: 12, 21 (the two U's of UDU overlap).
T(3,0) = 3: 132, 213, 321.
T(3,1) = 3: 123, 231, 312.
T(4,0) = 12: 1243, 1342, 1432, 2134, 2143, 2431, 3124, 3214, 3421, 4213, 4312, 4321.
T(4,1) = 4: 1234, 2341, 3412, 4123.
T(4,2) = 8: 1324, 1423, 2314, 2413, 3142, 3241, 4132, 4231.
Triangle T(n,k) begins:
:  0 :      1;
:  1 :      1;
:  2 :      0,      2;
:  3 :      3,      3;
:  4 :     12,      4,       8;
:  5 :     35,     45,      40;
:  6 :    144,    348,     132,     96;
:  7 :    910,   1862,    1316,    952;
:  8 :   5976,  11600,   14808,   5760,   2176;
:  9 :  39942, 100260,  123606,  63360,  35712;
: 10 : 306570, 919270, 1069910, 910650, 343040, 79360;
		

Crossrefs

Column k=0 gives A232899.
Row sums give A000142.
T(2n,n) gives A009752(n) = 2n * A000182(n) for n>0.
T(2n+1,n) gives (2n+1) * A024283(n) for n>0.
Cf. A295987.

Programs

  • Maple
    b:= proc(u, o, t) option remember; `if`(u+o=0,
         `if`(t=2, x, 1), expand(
          add(b(u+j-1, o-j, 2)*`if`(t=3, x, 1), j=1..o)+
          add(b(u-j, o+j-1, `if`(t=2, 3, 1)), j=1..u)))
        end:
    T:= n-> (p-> seq(coeff(p, x, i), i=0..degree(p)))
            (`if`(n<2, 1, n* b(0, n-1, 1))):
    seq(T(n), n=0..12);
  • Mathematica
    b[u_, o_, t_] := b[u, o, t] = If[u + o == 0, If[t == 2, x, 1], Expand[Sum[ b[u + j - 1, o - j, 2]*If[t == 3, x, 1], {j, 1, o}] + Sum[b[u - j, o + j - 1, If[t == 2, 3, 1]], {j, 1, u}]]];
    T[n_] := Function[p, Table[Coefficient[p, x, i], {i, 0, Exponent[p, x]}]]   [If[n < 2, 1, n*b[0, n - 1, 1]]];
    T /@ Range[0, 12] // Flatten (* Jean-François Alcover, Dec 19 2020, after Alois P. Heinz *)

A242820 Number T(n,k) of permutations of [n] with exactly k occurrences of the consecutive step pattern up, down, down, down; triangle T(n,k), n>=0, 0<=k<=max(0,floor((n-1)/4)), read by rows.

Original entry on oeis.org

1, 1, 2, 6, 24, 116, 4, 672, 48, 4536, 504, 34944, 5376, 302896, 59488, 496, 2916992, 697856, 13952, 30899616, 8720448, 296736, 357080064, 116109312, 5812224, 4470310976, 1645662912, 110697408, 349504, 60269056512, 24776769024, 2114735616, 17730048
Offset: 0

Views

Author

Alois P. Heinz, May 23 2014

Keywords

Examples

			T(5,1) = 4: (1,5,4,3,2), (2,5,4,3,1), (3,5,4,2,1), (4,5,3,2,1).
Triangle T(n,k) begins:
:  0 :        1;
:  1 :        1;
:  2 :        2;
:  3 :        6;
:  4 :       24;
:  5 :      116,       4;
:  6 :      672,      48;
:  7 :     4536,     504;
:  8 :    34944,    5376;
:  9 :   302896,   59488,    496;
: 10 :  2916992,  697856,  13952;
: 11 : 30899616, 8720448, 296736;
		

Crossrefs

Column k=0 gives A177518.
Row sums give: A000142.

Programs

  • Maple
    b:= proc(u, o, t) option remember; `if`(u+o=0, 1, expand(
          add(b(u-j, o+j-1, [1, 3, 4, 1][t])*`if`(t=4, x, 1), j=1..u)+
          add(b(u+j-1, o-j, 2), j=1..o)))
        end:
    T:= n-> (p-> seq(coeff(p, x, i), i=0..degree(p)))(b(n, 0, 1)):
    seq(T(n), n=0..15);
  • Mathematica
    b[u_, o_, t_] := b[u, o, t] = If[u + o == 0, 1, Expand[
         Sum[b[u - j, o + j - 1, {1, 3, 4, 1}[[t]]]*If[t==4, x, 1], {j, 1, u}]+
         Sum[b[u + j - 1, o - j, 2], {j, 1, o}]]];
    T[n_] := CoefficientList[b[n, 0, 1], x];
    T /@ Range[0, 15] // Flatten (* Jean-François Alcover, Mar 23 2021, after Alois P. Heinz *)

A295974 Number of length-n permutations avoiding descent patterns aba and bab.

Original entry on oeis.org

1, 1, 2, 6, 14, 52, 204, 1010, 5466, 34090, 233026, 1765836, 14534404, 129916550, 1248875862, 12872804422, 141470905326, 1652327596652, 20430973234388, 266683791698634, 3664052636652962, 52859944626536554, 798893924217099426, 12622926284124944660
Offset: 0

Views

Author

Jeffrey Shallit, Dec 01 2017

Keywords

Comments

The descent pattern of a permutation is the sign of the first difference of the permutation, with "a" denoting a rise (+1) and "b" denoting a descent (-1). For example, the permutation 364125 has descent pattern abbaa.

Examples

			For n = 4 the 10 permutations NOT counted are 1324, 1423, 2143, 2314, 2413, 3142, 3241, 3412, 4132, 4231.
		

Crossrefs

Column k=0 of A295987.
Cf. A296054.

Programs

  • Maple
    b:= proc(u, o, t, h) option remember;
               `if`(u+o=0, 1, `if`(t=0, add(b(u-j, j-1, 1$2), j=1..u),
           add(`if`(h=3, 0, b(u-j, o+j-1, [1, 3, 1][t], 2)), j=1..u)+
           add(`if`(t=3, 0, b(u+j-1, o-j, 2, [1, 3, 1][h])), j=1..o)))
        end:
    a:= n-> b(n, 0$3):
    seq(a(n), n=0..30);  # Alois P. Heinz, Dec 01 2017
  • Mathematica
    b[u_, o_, t_, h_] := b[u, o, t, h] = If[u + o == 0, 1, If[t == 0, Sum[b[u - j, j - 1, 1, 1], {j, 1, u}], Sum[If[h == 3, 0, b[u - j, o + j - 1, {1, 3, 1}[[t]], 2]], {j, 1, u}] + Sum[If[t == 3, 0, b[u + j - 1, o - j, 2, {1, 3, 1}[[h]]]], {j, 1,o}]]];
    a[n_] := b[n, 0, 0, 0];
    Table[a[n], {n, 0, 30}] (* Jean-François Alcover, Dec 28 2017, after Alois P. Heinz *)

Formula

Ehrenborg and Jung prove that a(n) ~ 0.8908970548...*(0.6869765032...)^(n-3)*n!.

Extensions

a(13)-a(23) from Alois P. Heinz, Dec 01 2017

A296054 Number of permutations of [n] with an equal number of occurrences of the consecutive step patterns 010 and 101, where 1=up and 0=down.

Original entry on oeis.org

1, 1, 2, 6, 14, 84, 344, 2714, 15850, 158664, 1254536, 15066332, 151035364, 2091499222, 25438986270, 398610118170, 5712650790562, 99963273184972, 1649446030193764, 31890910904182000, 594935710367215600, 12604160312187654888, 262094375885982582488
Offset: 0

Views

Author

Alois P. Heinz, Dec 03 2017

Keywords

Comments

a(n) * sqrt(n) / n! tends to 1.064409... - Vaclav Kotesovec, Aug 30 2021

Examples

			a(4) = 14: 1234, 1243, 1342, 1432, 2134, 2341, 2431, 3124, 3214, 3421, 4123, 4213, 4312, 4321 with step patterns 111, 110, 110, 100, 011, 110, 100, 011, 001, 100, 011, 001, 001, 000, respectively.
		

Crossrefs

Programs

  • Maple
    b:= proc(u, o, t, h, c) option remember; `if`(2*abs(c)-1>u+o, 0,
                `if`(u+o=0, 1, `if`(t=0, add(b(u-j, j-1, 1$2, 0), j=1..u),
           add(b(u-j, o+j-1, [1, 3, 1][t], 2, c+`if`(h=3, 1, 0)), j=1..u)+
           add(b(u+j-1, o-j, 2, [1, 3, 1][h], c-`if`(t=3, 1, 0)), j=1..o))))
        end:
    a:= n-> b(n, 0$4):
    seq(a(n), n=0..30);
  • Mathematica
    b[u_, o_, t_, h_, c_] := b[u, o, t, h, c] = If[2 Abs[c] - 1 > u+o, 0,
         If[u+o == 0, 1, If[t == 0, Sum[b[u-j, j-1, 1, 1, 0], {j, u}],
         Sum[b[u-j, o+j-1, {1, 3, 1}[[t]], 2, c+If[h == 3, 1, 0]], {j, u}]+
         Sum[b[u+j-1, o-j, 2, {1, 3, 1}[[h]], c-If[t == 3, 1, 0]], {j, o}]]]];
    a[n_] := b[n, 0, 0, 0, 0];
    Table[a[n], {n, 0, 30}] (* Jean-François Alcover, Aug 30 2021, after Alois P. Heinz *)
Showing 1-10 of 10 results.