There is a clever but tricky way to solve this. If we have to find the number of 4-digit integers that contains at least one 5, we can also find the number of all the 4-digit integers and the number of integers that do not contain any 5's and subtract it from the first number. This is called complementary counting.
So, first of all, we must find the number of 4-digit numbers there are. There are 9000 of them.
Now, we find the number of 4-digit integers without 5's. By thinking a little bit, we see the first digit must be from 0~9 excluding 5. That is a total of 9 numbers. This is the same for the next three digits. Therefore, there are 94 = 6561 4-digit numbers without a 5.
Finally, we can subtract. 9000 - 6561 = 2439
17
There are 9000 4-digit numbers. 8*9*9*9 = 5832 of them do not contain a 5 The remaining 3168 contain a 5.
-2
-5
-5
17
There are 9000 4-digit numbers. 8*9*9*9 = 5832 of them do not contain a 5 The remaining 3168 contain a 5.
1
-2
-5
-5
It would help to know which digit. 0 appears in 9 numbers and each of the others in 18 numbers.
252
There are 6804 such numbers.
The pages of a book are numbered from 1 to 128. How many page numbers contain the digit 6?
648
874