A295987
Number T(n,k) of permutations of [n] with exactly k (possibly overlapping) occurrences of the consecutive step patterns 010 or 101, where 1=up and 0=down; triangle T(n,k), n >= 0, k = max(0, n-3), read by rows.
Original entry on oeis.org
1, 1, 2, 6, 14, 10, 52, 36, 32, 204, 254, 140, 122, 1010, 1368, 1498, 620, 544, 5466, 9704, 9858, 9358, 3164, 2770, 34090, 67908, 90988, 72120, 63786, 18116, 15872, 233026, 545962, 762816, 839678, 560658, 470262, 115356, 101042, 1765836, 4604360, 7458522
Offset: 0
Triangle T(n,k) begins:
: 1;
: 1;
: 2;
: 6;
: 14, 10;
: 52, 36, 32;
: 204, 254, 140, 122;
: 1010, 1368, 1498, 620, 544;
: 5466, 9704, 9858, 9358, 3164, 2770;
: 34090, 67908, 90988, 72120, 63786, 18116, 15872;
: 233026, 545962, 762816, 839678, 560658, 470262, 115356, 101042;
-
b:= proc(u, o, t, h) option remember; expand(
`if`(u+o=0, 1, `if`(t=0, add(b(u-j, j-1, 1$2), j=1..u),
add(`if`(h=3, x, 1)*b(u-j, o+j-1, [1, 3, 1][t], 2), j=1..u)+
add(`if`(t=3, x, 1)*b(u+j-1, o-j, 2, [1, 3, 1][h]), j=1..o))))
end:
T:= n-> (p-> seq(coeff(p, x, i), i=0..degree(p)))(b(n, 0$3)):
seq(T(n), n=0..12);
-
b[u_, o_, t_, h_] := b[u, o, t, h] = Expand[If[u + o == 0, 1, If[t == 0, Sum[b[u - j, j - 1, 1, 1], {j, 1, u}], Sum[If[h == 3, x, 1]*b[u - j, o + j - 1, {1, 3, 1}[[t]], 2], {j, 1, u}] + Sum[If[t == 3, x, 1]*b[u + j - 1, o - j, 2, {1, 3, 1}[[h]]], {j, 1, o}]]]];
T[n_] := Function[p, Table[Coefficient[p, x, i], {i, 0, Exponent[p, x]}]][ b[n, 0, 0, 0]];
Table[T[n], {n, 0, 12}] // Flatten (* Jean-François Alcover, Jun 07 2018, from Maple *)
A228408
Number of permutations of [n] with exactly two (possibly overlapping) occurrences of some of the consecutive step patterns UUD, UDU, DUU (U=up, D=down).
Original entry on oeis.org
0, 0, 0, 0, 0, 29, 230, 1537, 11208, 89657, 724755, 6010150, 55305521, 545054759, 5504044595, 59482056555, 690974195737, 8306302563795, 104653460921783, 1401318441726295, 19525683104731681, 282626170020405627, 4296152288224050974, 67974610534037861728
Offset: 0
a(5) = 29: 12435, 12534, 13245, 13425, 13524, 14235, 14523, 15234, 21354, 21453, 23145, 23415, 23514, 24135, 24513, 25134, 31254, 31452, 32451, 34125, 34512, 35124, 41253, 41352, 42351, 45123, 51243, 51342, 52341.
a(6) = 230: 123546, 123645, 124365, ..., 651243, 651342, 652341.
a(7) = 1537: 1234657, 1234756, 1235476, ..., 7651243, 7651342, 7652341.
-
b:= proc(u, o, t, c) option remember;
`if`(c<0, 0, `if`(u+o=0, `if`(c=0, 1, 0),
add(b(u+j-1, o-j, [2, 3, 3, 6, 6, 3][t],
`if`(t in [5, 6], c-1, c)), j=1..o)+
add(b(u-j, o+j-1, [4, 5, 5, 4, 4, 5][t],
`if`(t=3, c-1, c)), j=1..u)))
end:
a:= n-> add(b(j-1, n-j, 1, 2), j=1..n):
seq(a(n), n=0..25);
A231385
Number of permutations of [n] avoiding simultaneously consecutive step patterns UUD, UDU, DUU (U=up, D=down).
Original entry on oeis.org
1, 1, 2, 6, 13, 39, 158, 674, 3304, 19511, 122706, 834131, 6416525, 52909708, 462097526, 4395014406, 44626369587, 476351029850, 5414386451909, 65177788719791, 821378978885730, 10880928171304446, 151423268838929524, 2197946731864495343, 33278572455563069142
Offset: 0
a(4) = 13: 1234, 1432, 2143, 2431, 3142, 3214, 3241, 3421, 4132, 4213, 4231, 4312, 4321.
a(5) = 39: 12345, 14325, 15324, ..., 54231, 54312, 54321.
a(6) = 158: 123456, 143265, 153264, ..., 654231, 654312, 654321.
-
b:= proc(u, o, t) option remember; `if`(t=7, 0, `if`(u+o=0, 1,
add(b(u+j-1, o-j, [2, 3, 3, 6, 7, 7][t]), j=1..o)+
add(b(u-j, o+j-1, [4, 5, 7, 4, 4, 5][t]), j=1..u)))
end:
a:= n-> `if`(n=0, 1, add(b(j-1, n-j, 1), j=1..n)):
seq(a(n), n=0..25);
-
b[u_, o_, t_] := b[u, o, t] = If[t == 7, 0, If[u + o == 0, 1,
Sum[b[u + j - 1, o - j, {2, 3, 3, 6, 7, 7}[[t]]], {j, 1, o}] +
Sum[b[u - j, o + j - 1, {4, 5, 7, 4, 4, 5}[[t]]], {j, 1, u}]]];
a[n_] := If[n == 0, 1, Sum[b[j - 1, n - j, 1], {j, 1, n}]];
a /@ Range[0, 25] (* Jean-François Alcover, Dec 22 2020, after Alois P. Heinz *)
A231386
Number of permutations of [n] with exactly one occurrence of one of the consecutive step patterns UUD, UDU, DUU (U=up, D=down).
Original entry on oeis.org
0, 0, 0, 0, 11, 52, 233, 1344, 8197, 49846, 351946, 2799536, 22764021, 200196218, 1947350444, 19753229932, 210793513246, 2425636703848, 29307938173409, 369141523106550, 4920501544208343, 68771635812423192, 998694091849893095, 15169308298544690802
Offset: 0
a(4) = 11: 1243, 1342, 2341 (=UUD), 1324, 1423, 2314, 2413, 3412 (=UDU), 2134, 3124, 4123 (=DUU).
a(5) = 52: 12354, 12453, 12543, ..., 53124, 53412, 54123.
a(6) = 233: 123465, 123564, 123654, ..., 653124, 653412, 654123.
a(7) = 1344: 1234576, 1234675, 1234765, ..., 7653124, 7653412, 7654123.
-
b:= proc(u, o, t) option remember; `if`(t=13, 0, `if`(u+o=0,
`if`(t>6, 1, 0), add(b(u+j-1, o-j,
[2, 3, 3, 6, 12, 9, 8, 9, 9, 12, 13, 13][t]), j=1..o)+
add(b(u-j, o+j-1,
[4, 5, 11, 4, 4, 5, 10, 11, 13, 10, 10, 11][t]), j=1..u)))
end:
a:= n-> add(b(j-1, n-j, 1), j=1..n):
seq(a(n), n=0..30);
-
b[u_, o_, t_] := b[u, o, t] = If[t==13, 0, If[u + o == 0, If[t > 6, 1, 0],
Sum[b[u+j-1, o-j,
{2, 3, 3, 6, 12, 9, 8, 9, 9, 12, 13, 13}[[t]]], {j, 1, o}] +
Sum[b[u-j, o+j-1,
{4, 5, 11, 4, 4, 5, 10, 11, 13, 10, 10, 11}[[t]]], {j, 1, u}]]];
a[n_] := Sum[b[j - 1, n - j, 1], {j, 1, n}];
a /@ Range[0, 30] (* Jean-François Alcover, Dec 22 2020, after Alois P. Heinz *)
A231410
Number of permutations of [n] with exactly n-3 (possibly overlapping) occurrences of some of the consecutive step patterns UUD, UDU, DUU (U=up, D=down).
Original entry on oeis.org
6, 11, 29, 99, 367, 1543, 7901, 41759, 241361, 1647843, 11321131, 83279563, 710717285, 6009605795, 53680350389, 549737059971, 5519982252151, 58008028652479, 693065960525741, 8057982367331159, 97381078055591177, 1329697914765988419, 17567989325451095443
Offset: 3
a(3) = 6: 123, 132, 213, 231, 312, 321.
a(4) = 11: 1243, 1342, 2341 (UUD), 1324, 1423, 2314, 2413, 3412 (UDU), 2134, 3124, 4123 (DUU).
a(5) = 29: 12435, 12534, 13245, ..., 51243, 51342, 52341.
a(6) = 99: 124356, 125346, 126345, ..., 623514, 624513, 634512.
a(7) = 367: 1243576, 1243675, 1253476, ..., 7346125, 7356124, 7456123.
-
b:= proc(u, o, t, c) option remember; `if`(u+o add(b(j-1, n-j, 1, n-3), j=1..n):
seq(a(n), n=3..25);
-
b[u_, o_, t_, c_] := b[u, o, t, c] = If[u + o < c, 0,
If[u + o == 0, If[c == 0, 1, 0],
Sum[b[u + j - 1, o - j, {2, 3, 3, 6, 6, 3}[[t]],
If[5 <= t <= 6, c - 1, c]], {j, 1, o}] +
Sum[b[u - j, o + j - 1, {4, 5, 5, 4, 4, 5}[[t]],
If[t == 3, c - 1, c]], {j, 1, u}]]];
a[n_] := Sum[b[j - 1, n - j, 1, n - 3], {j, 1, n}];
a /@ Range[3, 25] (* Jean-François Alcover, Mar 23 2021, after Alois P. Heinz *)
Showing 1-5 of 5 results.
Comments