The problem is as follows:

How many zeroes do we write when we write all the integers from 1 to 243 in base 3?

The given solution starts as follows:

The 1-digit numbers don't have any zeroes.

The 2-digit numbers use 2 zeroes: 10 and 20.

There are $3^2 = 9$ three-digit numbers starting with 1 and 9 starting with 2. For each leading digit, a zero appears in each digit in 9/3 = 3 of the numbers, so each has a total of 3+3 = 6 zeroes. Thus, the 3-digit numbers contain 2*6 = 12 zeroes.

I do not understand how they arrived with the fact that

"for each leading digit a zero appears in 9/3 = 3 of the numbers"

and why they are multiplying the result by 2 to get 12 at the end.


Half of the three-digit numbers start with 1; the other half start with 2. Consider those that start with 1. The 'middle' digit (to the left of the leading 1) can be a 0 in three different cases: when the rightmost (least significant) digit is 0, 1 or 2. Similarly, the rightmost digit will be 0 for the three values (0, 1, 2) that the middle digit will take on. Thus, for the three-digit numbers starting with 1, we use a total of 6 zeroes. The same calculation applies for the three-digit numbers with a leading 2. This gives us a total of $2*6 = 12$ zeroes in the three-digit numbers.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.