OFFSET
0,5
COMMENTS
Also the number of (1,2,1)-matching patterns of length n.
Also the number of (2,1,2)-matching patterns of length n.
We define a pattern to be a finite sequence covering an initial interval of positive integers. Patterns are counted by A000670 and ranked by A333217. A sequence S is said to match a pattern P if there is a not necessarily contiguous subsequence of S whose parts have the same relative order as P. For example, (3,1,1,3) matches (1,1,2), (2,1,1), and (2,1,2), but avoids (1,2,1), (1,2,2), and (2,2,1).
LINKS
Andrew Howroyd, Table of n, a(n) for n = 0..200
Wikipedia, Permutation pattern
FORMULA
E.g.f.: 1/(2-exp(x)) - (2-2*x+x^2)/(2*(1-x)^2). - Andrew Howroyd, Dec 31 2020
EXAMPLE
The a(3) = 1 through a(4) = 15 patterns:
(1,1,2) (1,1,1,2)
(1,1,2,1)
(1,1,2,2)
(1,1,2,3)
(1,1,3,2)
(1,2,1,2)
(1,2,1,3)
(1,2,2,3)
(1,3,1,2)
(2,1,1,2)
(2,1,1,3)
(2,1,2,3)
(2,2,1,3)
(2,2,3,1)
(3,1,1,2)
MATHEMATICA
allnorm[n_]:=If[n<=0, {{}}, Function[s, Array[Count[s, y_/; y<=#]+1&, n]]/@Subsets[Range[n-1]+1]];
Table[Length[Select[Join@@Permutations/@allnorm[n], MatchQ[#, {___, x_, ___, x_, ___, y_, ___}/; x<y]&]], {n, 0, 6}]
PROG
(PARI) seq(n)={Vec(serlaplace(1/(2-exp(x + O(x*x^n))) - (2-2*x+x^2)/(2*(1-x)^2)), -(n+1))} \\ Andrew Howroyd, Dec 31 2020
CROSSREFS
The complement A001710 is the avoiding version.
Permutations of prime indices matching this pattern are counted by A335446.
Patterns matching the pattern (1,1) are counted by A019472.
Combinatory separations are counted by A269134.
Patterns matched by standard compositions are counted by A335454.
Minimal patterns avoided by a standard composition are counted by A335465.
Patterns matching (1,2,3) are counted by A335515.
KEYWORD
nonn
AUTHOR
Gus Wiseman, Jun 18 2020
EXTENSIONS
Terms a(10) and beyond from Andrew Howroyd, Dec 31 2020
STATUS
approved