CEMC Banner

Problem of the Week
Problem D and Solution
Counting with Digit Tiles

Problem

For each digit from \(0\) to \(9\), you have \(100\) identical tiles with that digit on it.

Using these \(1000\) tiles, you start building consecutive positive integers, starting with \(1\). Each time you build an integer, you must remove the digit tiles you used from your stockpile of tiles.

For example, after you have built the integers from \(1\) to \(13\), the table below summarizes how many tiles remain for each digit.

Digit \(0\) \(1\) \(2\) \(3\) \(4\) \(5\) \(6\) \(7\) \(8\) \(9\)
Number of Tiles Remaining \(99\) \(94\) \(98\) \(98\) \(99\) \(99\) \(99\) \(99\) \(99\) \(99\)

What is the largest integer you can build without running out of the tiles needed to form the integer?

Solution

For the integers \(1\) to \(99\), each digit from \(1\) to \(9\) will be used the same number of times. The digit \(0\) will be used less than every other digit. As soon as we start to build the integer \(100\), the digit \(1\) will be used more frequently than any other digit. So, we will first run out of tiles with the digit \(1\) on them. Thus, we will count the number of times we can use a tile with the digit \(1\).

From \(1\) to \(99\), there is a \(1\) in the units digit of integers \(1\), \(11\), \(21\), \(31\), \(41\), \(51\), \(61\), \(71\), \(81\), \(91\), a total of \(10\) integers. There are also \(10\) integers with tens digit \(1\): \(10\), \(11\), \(12\), \(13\), \(14\), \(15\), \(16\), \(17\), \(18\), and \(19\). Thus, by the time we reach \(99\), we have used \(10+10=20\) tiles with the digit \(1\).

From \(100\) to \(109\), we use the digit \(1\) in the hundreds position \(10\) times, and in the units position of integer \(101\). Thus, we use \(11\) more tiles with the digit \(1\), so we have now used \(20 + 11 = 31\) such tiles.

From \(110\) to \(119\), we use the digit \(1\) in the hundreds position \(10\) times, in the tens position \(10\) times, and once in the units position. This makes a total of \(21\) more tiles with the digit \(1\) used, so we have now used \(31 + 21 = 52\) such tiles.

For each of \(120\) to \(129\), \(130\) to \(139\), \(140\) to \(149\), and \(150\) to \(159\), we use the same number of tiles with the digit \(1\) as we did when building integers from \(100\) to \(109\). So, to build the integers from \(120\) to \(159\) we use \(11+11+11+11=44\) tiles with the digit \(1\), and have now used a total of \(52 + 44 = 96\) such tiles.

Now we have four tiles with the digit \(1\) remaining. We can build \(160\), \(161\), and \(162\). After we have built the integer \(162\), no more tiles with the digit \(1\) remain, and so we cannot build the integer \(163\).

Therefore, the largest integer we can build to before running out of the necessary digits to create the integer is \(162\).