An infinite sequence of digits is obtained by writing all positive integers one after another in increasing order. Find the least positive integer such that among the first digits of the above sequence every two nonzero digits appear different number of times.
Problem 1792
Official solution
Solution:
Denote by the set of all digits of the numbers . First we find the least positive integer such that every two nonzero digits appear different number of times in . By adding zeros on the left we may assume that all numbers are -digit numbers.
It is clear that every nonzero digit appears the same number of times. Let be the number of appearances of the digit in position among the numbers . Note that for all and , if a number has in position , then replacing this digit by we obtain a number which is less than . Therefore .
Furthermore for a fixed the inequality is fulfilled for at most two pairs of digits and , namely and and . Moreover, if , it is fulfilled only for and . Since there are 8 pairs of the form we have . If then ; , i.e. satisfies the condition of the problem.
If also satisfies the condition then the first digit of is 1 and the second digit is or 3. Since is true only for 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 is 3. It follows by similar arguments that the third, fourth and the fifth digits of are respectively 5, 7 and 8. Therefore is the least positive integer such that every two nonzero digits appear different number of times in .
Since the number of digits of all numbers equals
we conclude that 56784 has the desired property.
Suppose that there exists which has the desired property. Then the digits in the sequence are those in for some and some digits of . According to the previous observations there exist two consecutive digits that are not digits of (eventually excluding the last one) appearing equal number of times in . If the last digit of is not 9, then the same digits appear equal number of times in the sequence since the digits of and are the same (except the last one). If the last digit of is 9 then the last digit of is 0 and therefore . Hence we conclude as above that there exist two consecutive digits not among the digits of which appear equal number of times.