Maths Olympiad Prep

Library /

Combinatorics Difficulty 8.7 Shortlist Prove it India

Let kk be a positive integer. A sequence of integers aii=1\langle a_i \rangle_{i=1}^\infty is called kk-pop if the following holds: for every nNn \in \mathbb{N}, ana_n is equal to the number of distinct elements in the set {a1,,an+k}\{a_1, \dots, a_{n+k}\}. Determine, as a function of kk, how many kk-pop sequences there are.

Solution

The answer is 2k2^k. Before we prove this, we will obtain a characterization of kk-pop sequences. To that end, note that in a kk-pop sequence, since the set {a1,,an+k+1}\{a_1, \dots, a_{n+k+1}\} has either the same number of distinct elements as {a1,,an+k}\{a_1, \dots, a_{n+k}\} or precisely one more, it follows that an+1a_{n+1} is either ana_n or an+1a_n+1 for each nn. A sequence bnn=1\langle b_n \rangle_{n=1}^\infty with the property that bn+1{bn,bn+1}b_{n+1} \in \{b_n, b_n+1\} for each nn will be called a step-sequence, and an index nn such that bn+1=bn+1b_{n+1} = b_n+1 will be called a step. Now we characterize kk-pop sequences:
Lemma A sequence ann=1\langle a_n \rangle_{n=1}^\infty is kk-pop if and only if it is a step-sequence and the following hold:
1. for each nn, the index nn is a step if and only if n+kn + k is, and
2. the number of steps among {1,,k}\{1, \dots, k\} is equal to a11a_1 - 1.
Proof. Assume ann=1\langle a_n \rangle_{n=1}^\infty is kk-pop. As seen before, it is a step-sequence. Now if nn is a step if and only if the number of distinct elements in {a1,,an+k+1}\{a_1, \dots, a_{n+k+1}\} is one more than that in {a1,,an+k}\{a_1, \dots, a_{n+k}\}, which is possible if and only an+k+1a_{n+k+1} is not an element of {a1,,an+k}\{a_1, \dots, a_{n+k}\}. Since ann=1\langle a_n \rangle_{n=1}^\infty is a step-sequence, this happens if and only if an+k+1=an+k+1a_{n+k+1} = a_{n+k} + 1, i.e., n+kn+k is a step. Now a1a_1 is equal to the number of distinct elements in {a1,,ak+1}\{a_1, \dots, a_{k+1}\}, which is obviously one more than the number of steps in {1,,k}\{1, \dots, k\}. This proves one direction of the implication.
Now assume ann=1\langle a_n \rangle_{n=1}^\infty is a step-sequence satisfying the two conditions. We will show by induction that ana_n is equal to the number of distinct elements in the set {a1,,an+k}\{a_1, \dots, a_{n+k}\}.
The base case n=1n=1 follows from condition (2): since it is a step-sequence, the number of distinct elements in {a1,,ak+1}\{a_1, \dots, a_{k+1}\} is one more than the number of steps in {1,,k}\{1, \dots, k\}, and thus equal to a1a_1. Now for a general m=n+1m=n+1, note that the number of distinct elements in {a1,,an+k+1}\{a_1, \dots, a_{n+k+1}\} is equal to the number of distinct elements in {a1,,an+k}\{a_1, \dots, a_{n+k}\} if an+k+1=an+ka_{n+k+1} = a_{n+k}, and one more than that otherwise. In the first case, n+kn+k is not a step, therefore, neither is nn, so an+1=ana_{n+1} = a_n, which is equal to the number of distinct elements in either of those sets. The other case is similar.
This shows our sequence is kk-pop. \square

Thus to determine a kk-pop sequence, it suffices to determine which of the indices in {1,,k}\{1, \dots, k\} are steps: by condition (1), this determines the locations of all steps, and by condition (2), this fixes a1a_1. Once these are fixed, ana_n 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 kk-pop sequence. There are exactly 2k2^k ways to choose the steps, which is therefore the answer. \square

Want a route through all this instead of an archive? The track puts 2,000 problems in a working order, from AMC 10 level to the IMO shortlist.

Source: MathNet, licensed CC-BY-4.0. Statement reproduced verbatim; metadata (topic, difficulty) added by this project.