Olympiad Maths Prep

Track / Stage 10 / 31 of 40 #1991 of 2000

Problem 1991

Hardest shortlist tier
Algebra Difficulty 9.3 Prove it IMO2024 Shortlisted Problems · IMO

Let NN be a positive integer and let a1,a2,a_{1}, a_{2}, \ldots be an infinite sequence of positive integers. Suppose that, for each n>Nn > N, ana_{n} is equal to the number of times an1a_{n-1} appears in the list a1,a2,,an1a_{1}, a_{2}, \ldots, a_{n-1}.
Prove that at least one of the sequences a1,a3,a5,a_{1}, a_{3}, a_{5}, \ldots and a2,a4,a6,a_{2}, a_{4}, a_{6}, \ldots is eventually periodic.

This one wants a proof. Work it on paper, read the official solution, then mark yourself honestly — the ladder only means something if the record is true.

Official solutions — 2

Solution 1

Let M>max(a1,,aN)M > \max \left(a_{1}, \ldots, a_{N}\right). We first prove that some integer appears infinitely many times. If not, then the sequence contains arbitrarily large integers. The first time each integer larger than MM appears, it is followed by a 11. So 11 appears infinitely many times, which is a contradiction.

Now we prove that every integer xMx \geqslant M appears at most M1M-1 times. If not, consider the first time that any xMx \geqslant M appears for the MthM^{\text{th}} time. Up to this point, each appearance of xx is preceded by an integer which has appeared xMx \geqslant M times. So there must have been at least MM numbers that have already appeared at least MM times before xx does, which is a contradiction.

Thus there are only finitely many numbers that appear infinitely many times. Let the largest of these be kk. Since kk appears infinitely many times there must be infinitely many integers greater than MM which appear at least kk times in the sequence, so each integer 1,2,,k11,2, \ldots, k-1 also appears infinitely many times. Since k+1k+1 doesn't appear infinitely often there must only be finitely many numbers which appear more than kk times. Let the largest such number be lkl \geqslant k. From here on we call an integer xx big if x>lx > l, medium if lx>kl \geqslant x > k and small if xkx \leqslant k. To summarise, each small number appears infinitely many times in the sequence, while each big number appears at most kk times in the sequence.

Choose a large enough NN' >> NN such that aNa_{N'} is small, and in a1,,aNa_{1}, \ldots, a_{N'}:
- every medium number has already made all of its appearances;
- every small number has made more than max(k,N)\max (k, N) appearances.

Since every small number has appeared more than kk times, past this point each small number must be followed by a big number. Also, by definition each big number appears at most kk times, so it must be followed by a small number. Hence the sequence alternates between big and small numbers after aNa_{N'}.

Lemma 1. Let gg be a big number that appears after aNa_{N'}. If gg is followed by the small number hh, then hh equals the amount of small numbers which have appeared at least gg times before that point.

Proof. By the definition of NN', the small number immediately preceding gg has appeared more than max(k,N)\max (k, N) times, so g>max(k,N)g > \max (k, N). And since g>Ng > N, the gthg^{\text{th}} appearance of every small number must occur after aNa_{N} and hence is followed by gg. Since there are kk small numbers and gg appears at most kk times, gg must appear exactly kk times, always following a small number after aNa_{N}. Hence on the hthh^{\text{th}} appearance of gg, exactly hh small numbers have appeared at least gg times before that point.

Denote by a[i,j]a_{[i, j]} the subsequence ai,ai+1,,aja_{i}, a_{i+1}, \ldots, a_{j}.

Lemma 2. Suppose that ii and jj satisfy the following conditions:
(a) j>i>N+2j > i > N' + 2,
(b) aia_{i} is small and ai=aja_{i} = a_{j},
(c) no small value appears more than once in a[i,j1]a_{[i, j-1]}.

Then ai2a_{i-2} is equal to some small number in a[i,j1]a_{[i, j-1]}.

Proof. Let I\mathcal{I} be the set of small numbers that appear at least ai1a_{i-1} times in a[1,i1]a_{[1, i-1]}. By Lemma 1, ai=Ia_{i} = |\mathcal{I}|. Similarly, let J\mathcal{J} be the set of small numbers that appear at least aj1a_{j-1} times in a[1,j1]a_{[1, j-1]}. Then by Lemma 1, aj=Ja_{j} = |\mathcal{J}| and hence by (b), I=J|\mathcal{I}| = |\mathcal{J}|. Also by definition, ai2Ia_{i-2} \in \mathcal{I} and aj2Ja_{j-2} \in \mathcal{J}.

Suppose the small number aj2a_{j-2} is not in I\mathcal{I}. This means aj2a_{j-2} has appeared less than ai1a_{i-1} times in a[1,i1]a_{[1, i-1]}. By (c), aj2a_{j-2} has appeared at most ai1a_{i-1} times in a[1,j1]a_{[1, j-1]}, hence aj1ai1a_{j-1} \leqslant a_{i-1}. Combining with a[1,i1]a[1,j1]a_{[1, i-1]} \subset a_{[1, j-1]}, this implies IJ\mathcal{I} \subseteq \mathcal{J}. But since aj2J\Ia_{j-2} \in \mathcal{J} \backslash \mathcal{I}, this contradicts I=J|\mathcal{I}| = |\mathcal{J}|. So aj2Ia_{j-2} \in \mathcal{I}, which means it has appeared at least ai1a_{i-1} times in a[1,i1]a_{[1, i-1]} and one more time in a[i,j1]a_{[i, j-1]}. Therefore aj1>ai1a_{j-1} > a_{i-1}.

By (c), any small number appearing at least aj1a_{j-1} times in a[1,j1]a_{[1, j-1]} has also appeared aj11ai1a_{j-1} - 1 \geqslant a_{i-1} times in a[1,i1]a_{[1, i-1]}. So JI\mathcal{J} \subseteq \mathcal{I} and hence I=J\mathcal{I} = \mathcal{J}. Therefore, ai2Ja_{i-2} \in \mathcal{J}, so it must appear at least aj1ai1=1a_{j-1} - a_{i-1} = 1 more time in a[i,j1]a_{[i, j-1]}.

For each small number ana_{n} with n>N+2n > N' + 2, let pnp_{n} be the smallest number such that an+pn=aia_{n + p_{n}} = a_{i} is also small for some ii with ni<n+pnn \leqslant i < n + p_{n}. In other words, an+pn=aia_{n + p_{n}} = a_{i} is the first small number to occur twice after an1a_{n-1}. If i>ni > n, Lemma 2 (with j=n+pnj = n + p_{n}) implies that ai2a_{i-2} appears again before an+pna_{n + p_{n}}, contradicting the minimality of pnp_{n}. So i=ni = n. Lemma 2 also implies that pnpn2p_{n} \geqslant p_{n-2}. So pn,pn+2,pn+4,p_{n}, p_{n+2}, p_{n+4}, \ldots is a nondecreasing sequence bounded above by 2k2k (as there are only kk small numbers). Therefore, pn,pn+2,pn+4,p_{n}, p_{n+2}, p_{n+4}, \ldots is eventually constant and the subsequence of small numbers is eventually periodic with period at most kk.

Solution 2

We follow Solution 1 until after Lemma 1. For each n>Nn > N', we keep track of how many times each of 1,2,,k1,2, \ldots, k has appeared in a1,,ana_{1}, \ldots, a_{n}. We will record this information in an updating (k+1)(k+1)-tuple
(b1,b2,,bk;j) \left(b_{1}, b_{2}, \ldots, b_{k} ; j\right)
where each bib_{i} records the number of times ii has appeared. The final element jj of the (k+1)(k+1) tuple, also called the active element, represents the latest small number that has appeared in a1,,ana_{1}, \ldots, a_{n}.

As nn increases, the value of (b1,b2,,bk;j)\left(b_{1}, b_{2}, \ldots, b_{k} ; j\right) is updated whenever ana_{n} is small. The (k+1)(k+1) tuple updates deterministically based on its previous value. In particular, when an=ja_{n} = j is small, the active element is updated to jj and we increment bjb_{j} by 11. The next big number is an+1=bja_{n+1} = b_{j}. By Lemma 1, the next value of the active element, or the next small number an+2a_{n+2}, is given by the number of bb terms greater than or equal to the newly updated bjb_{j}, or
{i1ik,bibj}. \left|\left\{i \mid 1 \leqslant i \leqslant k, b_{i} \geqslant b_{j}\right\}\right|.

Each sufficiently large integer which appears i+1i+1 times must also appear ii times, with both of these appearances occurring after the initial block of NN. So there exists a global constant CC such that bi+1biCb_{i+1} - b_{i} \leqslant C. Suppose that for some rr, br+1brb_{r+1} - b_{r} is unbounded from below. Since the value of br+1brb_{r+1} - b_{r} changes by at most 11 when it is updated, there must be some update where br+1brb_{r+1} - b_{r} decreases and br+1br<(k1)Cb_{r+1} - b_{r} < -(k-1)C. Combining with the fact that bibi1Cb_{i} - b_{i-1} \leqslant C for all ii, we see that at this particular point, by the triangle inequality
min(b1,,br)>max(br+1,,bk) \min \left(b_{1}, \ldots, b_{r}\right) > \max \left(b_{r+1}, \ldots, b_{k}\right)
Since br+1brb_{r+1} - b_{r} just decreased, the new active element is rr. From this point on, if the new active element is at most rr, by the previous formula, the next element to increase is once again from b1,,brb_{1}, \ldots, b_{r}. Thus only b1,,brb_{1}, \ldots, b_{r} will increase from this point onwards, and bkb_{k} will no longer increase, contradicting the fact that kk must appear infinitely often in the sequence. Therefore br+1br|b_{r+1} - b_{r}| is bounded.

Since br+1br|b_{r+1} - b_{r}| is bounded, it follows that each of bib1|b_{i} - b_{1}| is bounded for i=1,,ki = 1, \ldots, k. This means that there are only finitely many different states for (b1b1,b2b1,,bkb1;j)\left(b_{1} - b_{1}, b_{2} - b_{1}, \ldots, b_{k} - b_{1} ; j\right). Since the next active element is completely determined by the relative sizes of b1,b2,,bkb_{1}, b_{2}, \ldots, b_{k} to each other, and the update of bb terms depends on the active element, the active element must be eventually periodic. Therefore the small numbers subsequence, which is either a1,a3,a5,a_{1}, a_{3}, a_{5}, \ldots or a2,a4,a6,a_{2}, a_{4}, a_{6}, \ldots, must be eventually periodic.

Source: MathNet, licensed CC-BY-4.0. Statement and solution reproduced as published; topic, difficulty and ordering added by this site.