login
A228422
Number of permutations of [n] with exactly two (possibly overlapping) occurrences of some of the consecutive patterns 123, 1432, 2431, 3421.
2
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,6
LINKS
FORMULA
a(n) ~ c * (2/Pi)^n * n! * n^2, where c = 1.286210080518397686... . - Vaclav Kotesovec, Aug 28 2014
EXAMPLE
a(4) = 1: 1234.
a(5) = 14: 12354, 12453, 12543, 13452, 13542, 14532, 21345, 23451, 23541, 24531, 31245, 34521, 41235, 51234.
MAPLE
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);
MATHEMATICA
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 *)
CROSSREFS
Column k=2 of A231210.
Sequence in context: A153664 A016146 A269539 * A218089 A273587 A125449
KEYWORD
nonn
AUTHOR
Alois P. Heinz, Nov 09 2013
STATUS
approved