Let A be any set of positive integers and n a positive integer. A composition
of n with parts in A is an ordered collection of one or more elements in A
whose sum is n. We derive generating functions for the number of compositions
of n with m parts in A that have r occurrences of 3-letter patterns formed by
two (adjacent) instances of levels, rises and drops. We also derive asymptotics
for the number of compositions of n that avoid a given pattern. Finally, we
obtain the generating function for the number of k-ary words of length m which
contain a prescribed number of occurrences of a given pattern as a special case
of our results.Comment: 20 pages, 1 figure; accepted for the Proceedings of the 2005 Integer
Conferenc