# Probability that a k digit number does not contain certain digits

The probability that a $k$-digit number does NOT contain the digits 0,5 or 9

1. $0.3^k$
2. $0.6^k$
3. $0.7^k$
4. $0.9^k$

I'm confused since the question has asked the number should not contain 0,5 OR 9. So, should the answer be $0.9^k$ or something else?

• Out of ten digits, three are forbidden. Note: the problem allows the $k$-digit number to begin with a zero. – vadim123 Feb 14 '17 at 6:08
• So, the answer is $0.7^k$ ? – Ansh Kumar Feb 14 '17 at 6:10
• Yes. As for the language used, it is unfortunate how sometimes in english the words "or" and "and" seem to be used interchangably in some contexts. Here, the usual interpretation of how the problem is written is "... does not contain the digit 0 AND does not contain the digit 5 AND does not contain the digit 9." The answer to the question of "does not contain the digit 0 OR does not contain the digit 5 OR does not contain the digit 9" one should approach via inclusion-exclusion principle and the answer will appear a bit messier than the given answers. – JMoravitz Feb 14 '17 at 6:24
• As for the issue of whether or not leading zeroes count, almost always we treat the number $00053$ as a two digit number (as it can be rewritten as $53$) but as a five digit string. To correct the phrasing of the question to have $0.7^k$ actually be the right answer, it should instead be written "The probability that a number with at most $k$ digits happens to be a $k$-digit number without any of the digits $\{0,5,9\}$ appearing..." or written "The probability that a length $k$ numerical string..." to avoid that issue. Otherwise correct answer is $\frac{7^k}{9\cdot 10^{k-1}}$ – JMoravitz Feb 14 '17 at 6:29
• @JMoravitz How did you get $9.10^{k-1}$ – Ansh Kumar Feb 14 '17 at 6:45

Case I

Assumptions:

• The left most digit can be $0$.
• The questioner wants $0$, $5$ and $9$ to not occur simultaneously.(Here, or & and can be interchangeably used in this case.)

Solution:

Total no. of k digit numbers $= 10^k$

If $0, 5$ and $9$ can't be used, total no. of k digit numbers $= 7^k$

Hence, $$Probability=(7^k/10^k)=0.7^k$$

Case II

Assumptions:

• The left most digit can be $0$.
• The questioner wants one of $0$, $5$ and $9$ to not occur.

Solution:

Total no. of k digit numbers $= 10^k$

If one of $0, 5$ and $9$ can't be used, total no. of k digit numbers = $9^k$

Hence, $$Probability=(9^k/10^k)=0.9^k$$

Case III

Assumptions:

• The left most digit cannot be $0$.
• The questioner wants $0$, $5$ and $9$ to not occur simultaneously.

Solution:

Total no. of k digit numbers=$9 \times 10^{(k-1)}$

If one of $0, 5$ and $9$ can't be used, total no. of k digit numbers=$7^k$

Hence, $$Probability=\frac{7^k}{9 \times 10^{k-1}}$$

• It would be really nice if someone can help me in editing the last line. – Yash Swaraj Feb 14 '17 at 7:18
• use { }'s to make everything go in superscript. $a^{everything} b^JusttheJ$ produces $a^{everything} b^JusttheJ$. More MathJax and $\LaTeX$ tips here. – JMoravitz Feb 14 '17 at 7:32
• @YashSwaraj: Please check that my edit accurately captures your intent. – Brian Tung Feb 14 '17 at 7:41
• @BrianTung, thanks for your edit. – Yash Swaraj Feb 14 '17 at 15:08