A5. Dani wrote the integers from 1 to $N$. She used the digit 1 fifteen times. She used the digit 2 fourteen times.
What is $N$ ?
SOLUTION
41

In writing the integers 1 to 9 , both the digit 1 and the digit 2 are used once. In writing the integers 10 to 19 , the digit 1 is used 11 times and the digit 2 is used once. The opposite happens in writing the integers 20 to 29 with the digit 2 used 11 times and the digit 1 used once. Therefore, after writing the integers 1 to 29 , both digit 1 and digit 2 have been used 13 times. Both digit 1 and digit 2 are used once when writing the integers 30 to 39 making 14 uses in total for both. Therefore, the possible values of $N$ are the next integer which contains a digit 1 and above, up to and excluding an integer containing a digit 2. As 42 contains a digit 2, there is only one value of $N$ which satisfies the given conditions. Hence, $N$ is 41 .