|
|
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
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
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];
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|