# How many integers in $\big[1,10^6\big]$ include the numbers $1,2,3,4,5$ and how many only them

I want to check how many integral numbers in $\big[1,10^6\big]$ include the numbers $1,2,3,4,5$ and how many only them.
how should I check it? this is a problem of inclusion-exclusion?
I would like to get some advice!
Thanks!

-
I'm guessing you want integers, but as it is written, there are uncountably many since you can count decimal points. –  Clayton Aug 24 '13 at 12:23
I need Integers.. –  Ofir Attia Aug 24 '13 at 12:39
I understand this problem as this: How many integers exist in the inclusive interval $[1..10^6]$ that a) have at least one occurrence of one of the numbers [1,2,3,4,5] b) are entirely composed of the numbers [1,2,3,4,5]. Is that correct? –  Murch Aug 24 '13 at 12:44
Yes, I think about problem that I have 7 places to set the numbers [1,2,3,4,5] on them, but I dont know if its right –  Ofir Attia Aug 24 '13 at 12:45

Exclude $10^6$, and consider $[0,999999]$.

There are $10^6$ numbers in the interval $[0,999999]$. Each number in this interval can be thought of as having $6$ digits (So, $27$ would be $000027$). The numbers that do not satisfy the given property are entirely composed of $0,6,7,8,9$. So the total number of numbers to be excluded are $5^6$.

There are exactly $5$ one-digit numbers that satisfy this property. Similarly, there are $5^2$ two-digit numbers with this property. Continue and then sum all the numbers.

Make sure to consider $10^6$ in the end.

-

Hints:

• You do not need use inclusion-exclusion, though you can if you want to. Another approach to the first question could be to look at those which do not include any of $1,2,3,4,5$

• You might find it easier to treat $1000000$ and $0$ as special cases and instead look at the first question as if it was asking you to look at $[0,999999]$ with an adjustment.

• For the second question you might split the range by numbers of digits, i.e. into $[1,9]$, $[10,99]$, etc.

-