+0

# Counting

0
188
1

How many of the natural numbers from 1 to 600, inclusive, contain the digit 5 at least once or the digit 6 at least once?

Jun 11, 2021

#1
+288
+3

Let's write each integer from 0 to 599 with 0-padding to 3 digits.  So they are 000, 001, 002, ..., 599.  Let $S$ be the set of integers from 0 to 599, inclusive, that contain neither the digit 5 nor 6.   Then the answer we are seeking is $601-|S|$.  (There are 601 numbers from 0 to 600 inclusive; the number 000 is in $S$; and the number 600 contains 6 at least once.)

Looking at it this way, numbers in $S$ can be constructed like this:  Firstly, choose the leftmost digit from 0, 1, 2, 3, or 4.  There are 5 choices.  Secondly, choose the middle digit from 0, 1, 2, 3, 4, 7, 8, 9.   There are 8 choices.  Lastly, choose the rightmost digit from 0, 1, 2, 3, 4, 7, 8, 9.   Again there are 8 choices.   This gives $5\cdot 8\cdot 8= 320$ numbers in S.

So the answer to our question is $601-320=281$.

Jun 12, 2021