login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A335473 Number of compositions of n avoiding the pattern (2,1,2). 12

%I #13 Dec 31 2020 15:36:36

%S 1,1,2,4,8,15,29,55,103,190,347,630,1134,2028,3585,6291,10950,18944,

%T 32574,55692,94618,159758,268147,447502,743097,1227910,2020110,

%U 3308302,5394617,8757108,14155386,22784542,36529813,58343498,92850871,147254007,232750871,366671436

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

%C Also the number of (1,2,2) or (2,2,1)-avoiding 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="/A335473/b335473.txt">Table of n, a(n) for n = 0..200</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) - A335472(n).

%F a(n) = F(n,1,1) where F(n,m,k) = F(n,m+1,k) + k*(Sum_{i=1..floor(n/m)} F(n-i*m, m+1, k+i)) for m <= n with F(0,m,k)=1 and F(n,m,k)=0 otherwise. - _Andrew Howroyd_, Dec 31 2020

%e The a(0) = 1 through a(5) = 15 compositions:

%e () (1) (2) (3) (4) (5)

%e (11) (12) (13) (14)

%e (21) (22) (23)

%e (111) (31) (32)

%e (112) (41)

%e (121) (113)

%e (211) (122)

%e (1111) (131)

%e (221)

%e (311)

%e (1112)

%e (1121)

%e (1211)

%e (2111)

%e (11111)

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

%o (PARI) a(n)={local(Cache=Map()); my(F(n,m,k) = if(m>n, n==0, my(hk=[n,m,k], z); if(!mapisdefined(Cache,hk,&z), z=self()(n,m+1,k) + k*sum(i=1,n\m, self()(n-i*m, m+1, k+i)); mapput(Cache, hk, z)); z)); F(n,1,1)} \\ _Andrew Howroyd_, Dec 31 2020

%Y The version for patterns is A001710.

%Y The version for prime indices is A335450.

%Y These compositions are ranked by A335469.

%Y The (1,2,1)-avoiding version is A335471.

%Y The complement A335472 is the matching version.

%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 Compositions avoiding (1,2,3) are counted by A102726.

%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 Cf. A261982, A034691, A056986, A106356, A232464, A238279, A333755.

%K nonn

%O 0,3

%A _Gus Wiseman_, Jun 17 2020

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

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified September 6 11:48 EDT 2024. Contains 375712 sequences. (Running on oeis4.)