# Problem of the Week Problem D and Solution Wipe Away 2

## Problem

Ajay writes the positive integers from $$1$$ to $$1000$$ on a whiteboard. Jamilah then erases all the numbers that are multiples of $$9$$. Magdalena then erases all the remaining numbers that contain the digit $$9$$. How many numbers are left on the whiteboard?

Note: In solving this problem, it may be helpful to use the fact that a number is divisible by $$9$$ exactly when the sum of its digits is divisible by $$9$$. For example, the number $$214\,578$$ is divisible by $$9$$ since $$2+1+4+5+7+8 = 27$$, which is divisible by $$9$$. In fact, $$214\,578=9 \times 23\,842.$$

## Solution

We first calculate the number of integers that Jamilah erases, which is the number of multiples of $$9$$ between $$1$$ and $$1000$$. Since $$1000 = (111 \times 9) + 1$$, there are $$111$$ multiples of $$9$$ between $$1$$ and $$1000$$. Thus, Jamilah erases $$111$$ numbers from the whiteboard.

Now letâ€™s figure out how many of the integers from $$1$$ to $$1000$$ contain the digit $$9$$. The integers from $$1$$ to $$100$$ that contain the digit $$9$$ are $$9,19, \ldots, 79, 89$$ as well as $$90, 91, \ldots, 97 , 98, 99$$. Thus, there are $$19$$ positive integers from $$1$$ to $$100$$ that contain the digit $$9$$. Since there are $$19$$ integers from $$1$$ to $$100$$ that contain the digit $$9$$, it follows that there are $$19 \times 9 = 171$$ integers from $$1$$ to $$899$$ that contain the digit $$9$$.

Between $$900$$ and $$1000$$, there are $$100$$ integers that contain the digit $$9$$, namely, every number except for $$1000$$. Thus, in total, $$171+100 = 271$$ of the integers from $$1$$ to $$1000$$ contain the digit $$9$$.

However, some of the integers that contain the digit $$9$$ are also multiples of $$9$$, so were erased by Jamilah. To determine how many of these such numbers there are, we use the fact that a number is divisible by $$9$$ exactly when the sum of its digits is divisible by $$9$$.

• The only one-digit number that contains the digit $$9$$ and is also a multiple of $$9$$ is $$9$$ itself.

• The only two-digit numbers that contain the digit $$9$$ and are also multiples of $$9$$ are $$90$$ and $$99$$.

• To find the three-digit numbers that contain the digit $$9$$ and are also multiples of $$9$$, we will look at their digit sum.

• Case 1: Three digit-numbers with a digit sum of $$9$$:
The only possibility is $$900$$. Thus, there is $$1$$ number.

• Case 2: Three digit-numbers with a digit sum of $$18$$:

• If two of the digits are $$9$$, then the other digit must be $$0$$. The only possibilities are $$909$$ and $$990$$. Thus, there are $$2$$ numbers.

• If only one of the digits is $$9$$, then the other two digits must add to $$9$$. The possible digits are $$9$$, $$4$$, $$5$$, or $$9$$, $$3$$, $$6$$, or $$9$$, $$2$$, $$7$$, or $$9$$, $$8$$, $$1$$. For each of these sets of digits, there are $$3$$ choices for the hundreds digit. Once the hundreds digit is chosen, there are $$2$$ choices for the tens digit, and then the remaining digit must be the ones digit. Thus, there are $$3 \times 2=6$$ possible three-digit numbers for each set of digits. Since there are $$4$$ sets of digits, then there are $$4 \times 6 = 24$$ possible numbers.

• Case 3: Three digit-numbers with a digit sum of $$27$$:
The only possibility is $$999$$. Thus, there is $$1$$ number.

Therefore, there are $$1+2+24+1=28$$ three-digit numbers from $$1$$ to $$1000$$ that contain the digit $$9$$, and are also multiples of $$9$$.

Thus, there are $$1+2+28=31$$ numbers that contain the digit $$9$$, but were erased by Jamilah. It follows that Magdalena erases $$271-31=240$$ numbers from the whiteboard.

Hence, the number of numbers left on the whiteboard is $$1000 - 111 - 240 = 649$$.