Skip to main content
OlympiadHQ

Browse · MathNet

Print

IMO Problem Shortlist

counting and probability

Problem

For any integer , we compute the integer by applying the following procedure to its decimal representation. Let be the rightmost digit of . (1) If , then the decimal representation of results from the decimal representation of by removing this rightmost digit . (2) If we split the decimal representation of into a maximal right part that solely consists of digits not less than and into a left part that either is empty or ends with a digit strictly smaller than . Then the decimal representation of consists of the decimal representation of , followed by two copies of the decimal representation of . For instance, for the number , we will have , and . Prove that, starting with an arbitrary integer , iterated application of produces the integer after finitely many steps.
Solution
We identify integers with the digit-strings, briefly strings, of their decimal representation and extend the definition of to all non-empty strings with digits from to . We recursively define ten functions that map some strings into integers for . The function is only defined on strings (including the empty string ) that entirely consist of nines. If consists of nines, then , . For , the domain of is the set of all strings consisting only of digits that are . We write in the form where the strings only consist of digits . Note that some of these strings might equal the empty string and that is possible, i.e. the digit does not appear in . Then we define We will use the following obvious fact: Fact 1. If does not contain digits smaller than , then for all . In particular, for all . Moreover, by induction on it follows easily: Fact 2. If the nonempty string does not contain digits smaller than , then for all . We will show the essential fact: Fact 3. . Then the empty string will necessarily be reached after a finite number of applications of . But starting from a string without leading zeros, can only be reached via the strings . Hence also the number will appear after a finite number of applications of .

Proof of Fact 3. If the last digit of is , then we write where the do not contain the digit . Then and . So let the last digit of be at least . Let and be the corresponding left and right parts where is some string, and the string consists only of digits not less than . Then and . Let be the smallest digit of . We consider two cases which do not exclude each other.

Case 1. . Then In view of Fact 1 this difference is positive if and only if We have, using Fact 2, Here we use the additional definition if . Consequently, and according to Fact 1, .

Case 2. . We prove by induction on that for all . By Fact 1, it suffices to do so for . The initialization was already treated in Case 1. Let . Write in the form where does not contain digits . Then, in view of the induction hypothesis, Thus the inequality is established and from Fact 1 it follows that .

---

Alternative solution.

We identify integers with the digit-strings, briefly strings, of their decimal representation and extend the definition of to all non-empty strings with digits from to . Moreover, let us define that the empty string, , is being mapped to the empty string. In the following all functions map the set of strings into the set of strings. For two functions and let be defined by for all strings and let, for non-negative integers , denote the -fold application of . For any string let be the smallest digit of , and for the empty string let . We define nine functions as follows: Let and let be a string. If then . Otherwise, write in the form where is either the empty string or ends with a digit smaller than , and is the rightmost digit of . Then .

Lemma 1. We have for all .

Proof of Lemma 1. Let be as in the definition of . If , then , whence So let .

Case 1. contains a digit smaller than . Let where and . Then and Since ends with a digit smaller than , the equality is obviously true.

Case 2. does not contain a digit smaller than . Let where is either the empty string or ends with a digit smaller than and . We have and Recall that and hence ends with a digit smaller than , but all digits of are at least . Now if , then , whence the terminal digit of is smaller than , which entails If , then so that in both cases the equality is true. Thus Lemma 1 is proved.

Lemma 2. Let , let be a non-empty string and let be a positive integer. If then .

Proof of Lemma 2. We proceed by induction on . If we have Now consider the step from to where . Let and let . Then and by the induction hypothesis . In view of Lemma 1, Thus the induction step is complete and Lemma 2 is proved.

We say that the non-empty string terminates if for some non-negative integer .

Lemma 3. Let where ends with the digit and is possibly empty. If and terminate then also terminates.

Proof of Lemma 3. Suppose that and terminate. We proceed by induction on . Let . Obviously, for any non-empty string . Let . It follows easily by induction on that for . Consequently, . Since terminates, also terminates.

Now let the assertion be true for all nonnegative integers less than and let us prove it for where . It turns out that it is sufficient to prove that terminates. Indeed:

Case 1. . Then .

Case 2. . We have and . Then and we may apply the induction hypothesis to see that if terminates, then terminates.

Case 3. . Then . Note that has the form where . By the same arguments it is sufficient to prove that terminates and, by induction, that terminates for some positive integer . In view of Lemma 2 there is some such that , so terminates if terminates. Thus Lemma 3 is proved.

Now assume that there is some string that does not terminate. We choose minimal. If , we can write in the form of Lemma 3 and by this lemma terminates since and are smaller than . If , then and terminates again by Lemma 3 and the minimal choice of .

---

Alternative solution.

We commence by introducing some terminology. Instead of integers, we will consider the set of all strings consisting of the digits , including the empty string . If is a nonempty string, we let denote the terminal digit of and be the string with the last digit removed. We also define and denote the set of non-negative integers by .

Now let denote any digit. We define a function on the set of strings: First, if the terminal digit of belongs to , then is obtained from by deleting this terminal digit, i.e . Secondly, if the terminal digit of belongs to , then is obtained from by the process described in the problem. We also define . Note that up to the definition for integers , the function coincides with the function in the problem, through interpreting integers as digit strings. The argument will be roughly as follows. We begin by introducing a straightforward generalization of our claim about . Then it will be easy to see that has all these stronger properties, which means that is suffices to show for that possesses these properties provided that does.

We continue to use to denote any digit. The operation is said to be separating, if the following holds: Whenever is an initial segment of , there is some such that . The following two notions only apply to the case where is indeed separating, otherwise they remain undefined. For every we denote the least for which occurs by (because is an initial segment of , such an exists if is separating). If for every two strings and such that is a terminal segment of one has , we say that is coherent. In case that is separating and coherent we call the digit seductive.

As for all , it is obvious that is seductive. Hence in order to show that is seductive, which clearly implies the statement of the problem, it suffices to take any such that is seductive and to prove that has to be seductive as well. Note that in doing so, we have the function at our disposal. We have to establish two things and we begin with

Step 1. is separating.

Before embarking on the proof of this, we record a useful observation which is easily proved by induction on .

Claim 1. For any strings and any positive integer such that , we have

Now we call a pair of strings wicked provided that is an initial segment of , but there is no such that . We need to show that there are none, so assume that there were such pairs. Choose a wicked pair for which attains its minimal possible value. Obviously for any wicked pair . Let denote the terminal digit of . Observe that , which means that is also an initial segment of . To facilitate the construction of the eventual contradiction, we prove

Claim 2. There cannot be an such that

Proof of Claim 2. For suppose that such an existed. Because in view of the coherency of , the pair is not wicked. But then there is some for which which entails , contradiction. Hence Claim 2 is proved.

It follows that is impossible, for otherwise violated Claim 2. Also is impossible: Set . Then also , but and is an initial segment of . Thus the pair is not wicked. Hence there is some with , which, however, entails .

We are left with the case . Let denote the left part and the right part of . Then we have symbolically Using that is a terminal segment of and the coherency of , we infer Hence the pair is not wicked, so there is some minimal with and by Claim 1 it follows that . Finally, we infer that , which yields a contradiction to Claim 2.

This final contradiction establishes that is indeed separating.

Step 2. is coherent.

To prepare the proof of this, we introduce some further pieces of terminology. A nonempty string is called a hypostasis, if for all . Reading an arbitrary string backwards, we easily find a, possibly empty, sequence of hypostases such that and, symbolically, . The latter sequence is referred to as the decomposition of . So, for instance, is the decomposition of and the string is a hypostasis. Next we explain when we say about two strings and that is injectible into . The definition is by induction on the length of . Let be the decomposition of into hypostases. Then is injectible into if for the decomposition of there is a strictly increasing function satisfying is injectible into for all . If one can choose with , then we say that is strongly injectible into . Obviously, if is a terminal segment of , then is strongly injectible into .

Claim 3. If and are two nonempty strings such that is strongly injectible into , then is injectible into .

Proof of Claim 3. Let be the decomposition of and let be the decomposition of . Take a function exemplifying that is strongly injectible into . Let be the decomposition of and let be the decomposition of . Choose a strictly increasing witnessing that is injectible into . Clearly, is the decomposition of and is the decomposition of . Then the function given by for and for exemplifies that is injectible into , which finishes the proof of the claim.

A pair of strings is called aggressive if is injectible into and nevertheless . Observe that if was incoherent, which we shall assume from now on, then such pairs existed. Now among all aggressive pairs we choose one, say , for which attains its least possible value. Obviously cannot be injectible into , for otherwise the pair was aggressive and contradicted our choice of . Let and be the decompositions of and and take a function exemplifying that is indeed injectible into . If we had , then was also injectible into the number whose decomposition is and by separativity of we obtained , whence the pair was also aggressive, contrary to the minimality condition imposed on . Therefore is strongly injectible into . In particular, and have a common terminal digit, say . If we had , then and , so that by Claim 3, was injectible into , which is a contradiction. Hence, .

Now let be the minimal element of for which . Then the maximal right part of consisting of digits is equal to , the string whose decomposition is . Then is a hypostasis and is the decomposition of . Defining and in a similar fashion with respect to , we see that is the decomposition of . The definition of injectibility then easily entails that is strongly injectible into . It follows from Claim 3 that is injectible into , whence the function , given by for , and exemplifies that is injectible into , which yields a contradiction as before.

This shows that aggressive pairs cannot exist, whence is indeed coherent, which finishes the proof of the seductivity of , whereby the problem is finally solved.

Techniques

Invariants / monovariantsInduction / smoothingAlgorithms