A228422
Number of permutations of [n] with exactly two (possibly overlapping) occurrences of some of the consecutive patterns 123, 1432, 2431, 3421.
Original entry on oeis.org
0, 0, 0, 0, 1, 14, 164, 1589, 15034, 139465, 1334945, 13108425, 134906641, 1443572465, 16238742806, 190546010823, 2347715040542, 30162115442344, 405859441345002, 5684963539755583, 83163913991455832, 1263763900212930657, 20000260465018111763
Offset: 0
a(4) = 1: 1234.
a(5) = 14: 12354, 12453, 12543, 13452, 13542, 14532, 21345, 23451, 23541, 24531, 31245, 34521, 41235, 51234.
-
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, 2, 2][t], `if`(t=2, c-1, c)), j=1..o)+
add(b(u-j, o+j-1, [1, 3, 1][t], `if`(t=3, c-1, c)), j=1..u)))
end:
a:= n-> b(n, 0, 1, 2):
seq(a(n), n=0..25);
-
b[u_, o_, t_, c_] := b[u, o, t, c] =
If[c<0, 0, If[u+o == 0, If[c == 0, 1, 0],
Sum[b[u+j-1, o-j, 2, If[t == 2, c-1, c]], {j, 1, o}] +
Sum[b[u-j, o+j-1, {1, 3, 1}[[t]], If[t == 3, c-1, c]], {j, 1, u}]]];
a[n_] := b[n, 0, 1, 2];
Table[a[n], {n, 0, 25}] (* Jean-François Alcover, Dec 20 2020, after Alois P. Heinz *)
A231211
Number of permutations of [n] avoiding simultaneously consecutive patterns 123, 1432, 2431, and 3421.
Original entry on oeis.org
1, 1, 2, 5, 14, 46, 177, 790, 4024, 23056, 146777, 1027850, 7852184, 64985116, 579191277, 5530869310, 56336971744, 609708912976, 6986749484177, 84510154473170, 1076016705993704, 14385283719409636, 201475033030143477, 2950048762311387430, 45073424916825354064
Offset: 0
a(3) = 5: 132, 213, 231, 312, 321.
a(4) = 14: 1324, 1423, 2143, 2314, 2413, 3142, 3214, 3241, 3412, 4132, 4213, 4231, 4312, 4321.
a(5) = 46: 13254, 14253, 14352, ..., 54231, 54312, 54321.
a(6) = 177: 132546, 132645, 142536, ..., 654231, 654312, 654321.
-
b:= proc(u, o, t) option remember; `if`(t=4, 0, `if`(u+o=0, 1,
add(b(u+j-1, o-j, [2, 4, 2][t]), j=1..o)+
add(b(u-j, o+j-1, [1, 3, 4][t]), j=1..u)))
end:
a:= n-> b(n, 0, 1):
seq(a(n), n=0..30);
# second Maple program
n:=40: c[0,0]:=1: for i to n-1 do c[i,0]:=0 end do: for i to n-1 do for j to i do c[i,j] := c[i,j-1] + c[i-1,i-j] + 1 end do end do: 1, seq(c[k, k]/2, k=1..n-1); # Sergei N. Gladkovskii, Jul 27 2015
-
b[u_, o_, t_] := b[u, o, t] = If[t == 4, 0, If[u + o == 0, 1,
Sum[b[u + j - 1, o - j, {2, 4, 2}[[t]]], {j, 1, o}] +
Sum[b[u - j, o + j - 1, {1, 3, 4}[[t]]], {j, 1, u}]]];
a[n_] := b[n, 0, 1];
a /@ Range[0, 30] (* Jean-François Alcover, Dec 22 2020, after Alois P. Heinz *)
A231228
Number of permutations of [n] with exactly one occurrence of one of the consecutive patterns 123, 1432, 2431, 3421.
Original entry on oeis.org
0, 0, 0, 1, 9, 59, 358, 2235, 14658, 103270, 778451, 6315499, 54733657, 507655301, 5003179539, 52430810493, 580611272956, 6796733911852, 83658527086447, 1083027034959367, 14678725047527255, 208344799726820123, 3084495765476262875, 47646333262275943521
Offset: 0
a(3) = 1: 123.
a(4) = 9: 1243, 1342, 1432, 2134, 2341, 2431, 3124, 3421, 4123.
a(5) = 59: 12435, 12534, 13245, ..., 53124, 53421, 54123.
a(6) = 358: 124365, 125364, 125463, ..., 653124, 653421, 654123.
-
b:= proc(u, o, t) option remember;
`if`(t=7, 0, `if`(u+o=0, `if`(t in [4, 5, 6], 1, 0),
add(b(u+j-1, o-j, [2, 5, 2, 5, 7, 5][t]), j=1..o)+
add(b(u-j, o+j-1, [1, 3, 4, 4, 6, 7][t]), j=1..u)))
end:
a:= n-> b(n, 0, 1):
seq(a(n), n=0..25);
-
b[u_, o_, t_] := b[u, o, t] = If[t==7, 0, If[u+o==0, If[4 <= t <= 6, 1, 0],
Sum[b[u + j - 1, o - j, {2, 5, 2, 5, 7, 5}[[t]]], {j, 1, o}] +
Sum[b[u - j, o + j - 1, {1, 3, 4, 4, 6, 7}[[t]]], {j, 1, u}]]];
a[n_] := b[n, 0, 1];
a /@ Range[0, 25] (* Jean-François Alcover, Jan 03 2021, after Alois P. Heinz *)
Showing 1-3 of 3 results.
Comments