Maths Olympiad Prep

Track / Stage 6 / 312 of 400 #1792 of 2444

Problem 1792

National Olympiad, first round
Combinatorics Difficulty 6.8 Prove it Bulgarian Mathematical Olympiad · Bulgaria

An infinite sequence of digits is obtained by writing all positive integers one after another in increasing order. Find the least positive integer kk such that among the first kk digits of the above sequence every two nonzero digits appear different number of times.

This one wants a proof. Work it on paper, then read the official solution and mark yourself. Be honest about it: the record is only any use to you if it is.

Next problem →

Official solution

Solution:
Denote by MnM_{n} the set of all digits of the numbers 1,2,,n1,2, \ldots, n. First we find the least positive integer n=a1a2atn=\overline{a_{1} a_{2} \ldots a_{t}} such that every two nonzero digits appear different number of times in MnM_{n}. By adding zeros on the left we may assume that all numbers 1,2,,n11,2, \ldots, n-1 are tt-digit numbers.

It is clear that every nonzero digit appears the same number of times. Let Bij,1it,1j9B_{i}^{j}, 1 \leq i \leq t, 1 \leq j \leq 9 be the number of appearances of the digit jj in position ii among the numbers 1,2,,n1,2, \ldots, n. Note that for all ii and j8j \leq 8, if a number AA has j+1j+1 in position ii, then replacing this digit by jj we obtain a number which is less than AA. Therefore BijBij+1B_{i}^{j} \geq B_{i}^{j+1}.

Furthermore for a fixed ii the inequality BijBij+1B_{i}^{j} \geq B_{i}^{j+1} is fulfilled for at most two pairs of digits jj and j+1j+1, namely ai1a_{i-1} and ai;aia_{i} ; a_{i} and ai+1a_{i+1}. Moreover, if i=ti=t, it is fulfilled only for ata_{t} and at+1a_{t+1}. Since there are 8 pairs of the form (j,j+1)(j, j+1) we have t5t \geq 5. If n=13578n=13578 then B11>B12;B22>B23;B23>B24B_{1}^{1}>B_{1}^{2} ; B_{2}^{2}>B_{2}^{3} ; B_{2}^{3}>B_{2}^{4}; B34>B35;B35>B36;Bˉ46>B47;B47>B48;B58>B59B_{3}^{4}>B_{3}^{5} ; B_{3}^{5}>B_{3}^{6} ; \bar{B}_{4}^{6}>B_{4}^{7} ; B_{4}^{7}>B_{4}^{8} ; B_{5}^{8}>B_{5}^{9}, i.e. n=13578n=13578 satisfies the condition of the problem.

If m<13578m<13578 also satisfies the condition then the first digit of mm is 1 and the second digit is 0,1,20,1,2 or 3. Since B1j>B1j+1B_{1}^{j}>B_{1}^{j+1} is true only for j=1j=1 if the second digit is 0,1 or 2 then at least two consecutive digits appear equal number of times. Therefore the second digit of mm is 3. It follows by similar arguments that the third, fourth and the fifth digits of mm are respectively 5, 7 and 8. Therefore n=13578n=13578 is the least positive integer such that every two nonzero digits appear different number of times in MnM_{n}.

Since the number of digits of all numbers 1,2,3,,135781,2,3, \ldots, 13578 equals
91+902+9003+90004+35795=56784 9 \cdot 1 + 90 \cdot 2 + 900 \cdot 3 + 9000 \cdot 4 + 3579 \cdot 5 = 56784
we conclude that 56784 has the desired property.

Suppose that there exists k<56784k<56784 which has the desired property. Then the digits in the sequence are those in MsM_{s} for some s<13578s<13578 and some digits of s+1s+1. According to the previous observations there exist two consecutive digits that are not digits of ss (eventually excluding the last one) appearing equal number of times in MsM_{s}. If the last digit of ss is not 9, then the same digits appear equal number of times in the sequence since the digits of ss and s+1s+1 are the same (except the last one). If the last digit of ss is 9 then the last digit of s+1s+1 is 0 and therefore s+1<13578s+1<13578. Hence we conclude as above that there exist two consecutive digits not among the digits of s+1s+1 which appear equal number of times.

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