How many nondecreasing sequences are composed entirely of at most three distinct numbers from the set (so and are both allowed)?
Solution
From any sequence , construct a sequence , where counts the number of times occurs in the sequence. There is a correspondence from all possible sequences with at most 3 nonzero terms which add to 10 , since any sequence of will be converted to this form, and from any sequence , we can construct a unique sequence of -s by listing times (for ) in nondecreasing order. Our goal now is to count the number of possible sequences meeting our conditions. We casework on the number of nonzero terms in the sequence: Case 1: The sequence has exactly one nonzero term. Then exactly one of is equal to 10 , and all the rest are equal to 0 . This gives us 9 possible sequences in this case. Case 2: The sequence has exactly two nonzero terms. There are ways to choose the two terms which are nonzero. From here, we have 9 choices for the value of , namely 1 through 9 (since both and must be nonzero), and will be fixed, so this case gives us possible sequences. Case 3: The sequence has exactly three nonzero terms. There are ways to choose the three terms which are nonzero. Letting , we have that are nonnegative integers which sum to 7 . There are solutions to this equation (consider placing two dividers in the nine spaces between the ten elements), giving possbilities in this case. We then have possible sequences.