Let be a positive integer. A sequence of integers is called -pop if the following holds: for every , is equal to the number of distinct elements in the set . Determine, as a function of , how many -pop sequences there are.
Solution
The answer is . Before we prove this, we will obtain a characterization of -pop sequences. To that end, note that in a -pop sequence, since the set has either the same number of distinct elements as or precisely one more, it follows that is either or for each . A sequence with the property that for each will be called a step-sequence, and an index such that will be called a step. Now we characterize -pop sequences:
Lemma A sequence is -pop if and only if it is a step-sequence and the following hold:
1. for each , the index is a step if and only if is, and
2. the number of steps among is equal to .
Proof. Assume is -pop. As seen before, it is a step-sequence. Now if is a step if and only if the number of distinct elements in is one more than that in , which is possible if and only is not an element of . Since is a step-sequence, this happens if and only if , i.e., is a step. Now is equal to the number of distinct elements in , which is obviously one more than the number of steps in . This proves one direction of the implication.
Now assume is a step-sequence satisfying the two conditions. We will show by induction that is equal to the number of distinct elements in the set .
The base case follows from condition (2): since it is a step-sequence, the number of distinct elements in is one more than the number of steps in , and thus equal to . Now for a general , note that the number of distinct elements in is equal to the number of distinct elements in if , and one more than that otherwise. In the first case, is not a step, therefore, neither is , so , which is equal to the number of distinct elements in either of those sets. The other case is similar.
This shows our sequence is -pop.
Thus to determine a -pop sequence, it suffices to determine which of the indices in are steps: by condition (1), this determines the locations of all steps, and by condition (2), this fixes . Once these are fixed, can be determined inductively. Conversely, any such selection of indices gives rise to a step-sequence satisfying the conditions in the lemma by the aforementioned recipe, and thus a -pop sequence. There are exactly ways to choose the steps, which is therefore the answer.