Avoidance of Nonsubword Patterns in Compositions 141
contain a given pattern from the total number of compositions of n gives the
desired sequence of values. This approach allows us to get the values for the
number of compositions that avoid either 112 or 221 for n ≤ 15 before the
computational effort becomes too large. Below we give the Mathematica code
for the pattern matching approach for 112.
comps[n_]:=Flatten[Map[Permutations,IntegerPartitions[n]],1];
Table[2^(k - 1) - Length[Position[comps[k],
{___, x_, ___, x_, ___, y_, ___} /; x<y]], {k,1,15}]
The sequence of values [x
n
]AC
112
A
(x, y) is given by 1, 1, 2, 4, 7, 13, 23,
40, 67, 115, 190, 311, 505, 807, 1285,and2031 for n =0, 1,...,15;the
corresponding sequence for the pattern 221 is given by 1, 1, 2, 4, 8, 15, 29,
55, 103, 190, 347, 630, 1134, 2028, 3585,and6291.
Since both Mathematica and Maple reach their limits rather quickly, we
provide C++ and Java codes for finding the sequence of values for the number
of compositions of n with parts in N that avoid a subsequence pattern τ of
length less than or equal to seven for any n. These programs are given in
Appendix G. For results on avoiding more than one pattern with repetitions
we refer the reader to [91] and Exercise 5.5.
5.2.3 Wilf-classes for longer subsequence patterns
In the previous two subsections we completely classified the patterns of
length three according to Wilf-equivalence. We summarize these results in
Table 5.1 for the nontrivial Wilf-equivalence classes, that is, those that do not
just contain a pattern and its reverse. For patterns of length three, the only
trivial class consists of the pattern 111.
TABLE 5.1: Wilf-equivalence classes for patterns of length three
123∼132∼213 112∼121 122∼212
For longer patterns, Mansour and Jel´ınek [105, 104] provided classifica-
tion results for patterns according to strong equivalence which implies Wilf-
equivalence (see Definition 6.10). Utilizing the C++ code given in Appendix
G together with their structure results (Propositions 6.18 and 6.19 and The-
orem 6.20), Mansour and Jel´ınek gave a complete classification for patterns
of lengths four and five for compositions. Tables 5.2 and 5.3 list the lexico-
graphically minimal patterns for the nontrivial Wilf-equivalence classes.
More detailed tables where the equivalence classes are listed together with
values of AC
τ
(n) for selected values of n appear in Appendix G. The values
© 2010 by Taylor and Francis Group, LLC