1997 PMWC Problems/Problem T3

Problem

To type all the integers from 1 to 1997 using a typewriter on a piece of paper, how many times is the key '9' needed to be pressed?

Solution 1

Let's call the three digit, two digit, and one digit numbers, when combined, the 0 thousands.

The 0 thousand has the same number of nines as the one thousand, so we can compute the number of nines in the 0 thousands and multiply it by 2 and subtract 5, since we are leaving out 1998 and 1999.

  • one digit: one nine, obviously.
  • two digit: a nine times nine, plus 10 other nines, is 19 nines.
  • three digit: 20 per hundred, plus another hundred for the 900s, is 280.

$20+280=300 \Longrightarrow 300*2-5=595$ is the answer.

Solution 2

Consider the numbers from 1 to 1000. Since 9 appears $\frac{1}{10}$ of the time for each digit (if we include 0), there are $\frac{1000}{10} = 100$ '9's in each place, for a total of $300$ '9's. Repeating again up to 2000, there are $600$ '9's; we exclude $1998, 1999$, so we have $600 - 5 = 595$ '9's.

See Also

1997 PMWC (Problems)
Preceded by
Problem T2
Followed by
Problem T4
I: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
T: 1 2 3 4 5 6 7 8 9 10