login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

Number of compositions of n matching the pattern (1,2,1).
13

%I #14 Dec 31 2020 15:36:11

%S 0,0,0,0,1,3,9,24,61,141,322,713,1543,3289,6907,14353,29604,60640,

%T 123522,250645,506808,1022197,2057594,4135358,8301139,16648165,

%U 33364948,66831721,133814251,267850803,536026676,1072528081,2145745276,4292485526,8586405894,17174865820

%N Number of compositions of n matching the pattern (1,2,1).

%C Also the number of (1,1,2)-matching or (2,1,1)-matching compositions.

%C 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).

%C A composition of n is a finite sequence of positive integers summing to n.

%H Andrew Howroyd, <a href="/A335470/b335470.txt">Table of n, a(n) for n = 0..1000</a>

%H Wikipedia, <a href="https://en.wikipedia.org/wiki/Permutation_pattern">Permutation pattern</a>

%H Gus Wiseman, <a href="https://oeis.org/A102726/a102726.txt">Sequences counting and ranking compositions by the patterns they match or avoid.</a>

%F a(n > 0) = 2^(n - 1) - A335471(n).

%e The a(4) = 1 through a(6) = 9 compositions:

%e (121) (131) (141)

%e (1121) (1131)

%e (1211) (1212)

%e (1221)

%e (1311)

%e (2121)

%e (11121)

%e (11211)

%e (12111)

%t Table[Length[Select[Join@@Permutations/@IntegerPartitions[n],MatchQ[#,{___,x_,___,y_,___,x_,___}/;x<y]&]],{n,0,10}]

%Y The version for prime indices is A335446.

%Y These compositions are ranked by A335466.

%Y The complement A335471 is the avoiding version.

%Y The (2,1,2)-matching version is A335472.

%Y The version for patterns is A335509.

%Y Constant patterns are counted by A000005 and ranked by A272919.

%Y Permutations are counted by A000142 and ranked by A333218.

%Y Patterns are counted by A000670 and ranked by A333217.

%Y Compositions are counted by A011782.

%Y Non-unimodal compositions are counted by A115981 and ranked by A335373.

%Y Combinatory separations are counted by A269134.

%Y Patterns matched by compositions are counted by A335456.

%Y Minimal patterns avoided by a standard composition are counted by A335465.

%Y Compositions matching (1,2,3) are counted by A335514.

%Y Cf. A261982, A034691, A056986, A106356, A238279, A333755, A335454.

%K nonn

%O 0,6

%A _Gus Wiseman_, Jun 17 2020

%E Terms a(21) and beyond from _Andrew Howroyd_, Dec 31 2020