An S-restricted composition of a positive integer n is an ordered partition of n where each summand is drawn from a given subset S of positive integers. There are various problems regarding such compositions which have received attention in recent years. This paper is an attempt at finding a closed- form formula for the number of S-restricted compositions of n. To do so, we reduce the problem to finding solutions to corresponding so-called interpreters which are linear homogeneous recurrence relations with constant coefficients. Then, we reduce interpreters to Diophantine equations. Such equations are not in general solvable. Thus, we restrict our attention to those S-restricted composition problems whose interpreters have a small number of coefficients, thereby leading to solvable Diophantine equations. The formalism developed is then used to study the integer sequences related to some well-known cases of the S-restricted composition problem.
We study compositions of the integer @math in which the first part, successive differences, and the last part are constrained to lie in prescribed sets @math , respectively. A simple condition on @math guarantees that the generating function @math has only a simple pole on its circle of convergence and this at @math , a function independent of @math and @math . Thus the number of compositions is asymptotic to @math for a suitable constant @math . We prove a multivariate central and local limit theorem and apply it to various statistics of random locally restricted compositions of @math , such as number of parts, numbers of parts of given sizes, and number of rises. The first and last parts are shown to have limiting distributions and to be asymptotically independent. If @math has only finitely many positive elements @math , or finitely many negative elements @math , then the largest part and number of distinct part sizes are almost surely @math . On the other hand, when both @math and @math have a positive asymptotic lower "local log-density", we prove that the largest part and number of distinct part sizes are almost surely @math , and we give sufficient conditions for the largest part to be almost surely asymptotic to @math . A partially ordered (generalized) pattern (POP) is a generalized pattern some of whose letters are incomparable, an extension of generalized permutation patterns introduced by Babson and Steingr´omsson. POPs were introduced in the symmetric group by Kitaev [19, 21], and studied in the set of k-ary words by Kitaev and Mansour [22]. Moreover, [23] introduced segmented POPs in compositions. In this paper, we study avoidance of POPs in compositions and generalize results for avoidance of POPs in permutations and words. Specifically, we obtain results for the generating functions for the number of compositions that avoid shuffle patterns and multi-patterns. In addition, we give the generating function for the distribution of the maximum number of nonoverlapping occurrences of a segmented POP τ (that is allowed to have repeated letters) among the compositions of n with m parts in a given set, provided we know the generating function for the number of compositions of n with m parts in the given set that avoid τ. This result is a q-analogue of the main result in [22].   We find generating functions for the number of compositions avoiding a single pattern or a pair of patterns of length three on the alphabet 1,2 and determine which of them are Wilf-equivalent on compositions. We also derive the number of permutations of a multiset which avoid these same patterns and determine the Wilf-equivalence of these patterns on permutations of multisets.  We show that among the compositions of n into positive parts, the number g(n) that avoid a given pattern @p of three letters is independent of @p. We find the generating function of g(n) , and it shows that the sequence g(n) is not P-recursive. If S is a given multiset, we show that the number of permutations of S that avoid a pattern @p of three letters is independent of @p. Finally, we give a bijective proof of the fact that if M=1^a^"^1...k^a^"^k is a given multiset then the number of permutations of M that avoid the pattern (123) is a symmetric function of the multiplicities a"1,...,a"k. The bijection uses the Greene-Kleitman symmetric chain decomposition of the Boolean lattice.  We define the notion of @math -free for locally restricted compositions, which means roughly that if such a composition contains a part @math and nearby parts are at least @math smaller, then @math can be replaced by any larger part. Two well-known examples are Carlitz and alternating compositions. We show that large parts have asymptotically geometric distributions. This leads to asymptotically independent Poisson variables for numbers of various large parts. Based on this we obtain asymptotic formulas for the probability of being gap free and for the expected values of the largest part and number distinct parts, all accurate to @math .