1
$\begingroup$

Additional rule: each digit is one of $\{0,1,2...9\}$ and the first digit is nonzero.

I think this question isn't hard, I just don't seem to be clear about the question.

My interpretation: How many numbers which don't contain 7 have at least a 2 AND have at least a 3.

My answer:

= all non-7-containing numbers - non-7-containing numbers that have no 2 and no 3

= $8*9^{n-1} - 6*7^{n-1}$ (answer is currently wrong)

$\endgroup$
2
$\begingroup$

We use Inclusion/Exclusion.

It is easy to count the numbers that are missing a $7$. Suppose there are $a$ of them.

Call such a number bad if it is also missing $2$ or $3$ or both.

It is not hard to count the numbers that miss $7$ and $2$. Suppose there are $b$ of them.

Then there are $b$ numbers that miss $7$ and $3$.

But $b+b$ double-counts the numbers that miss $7$, $2$, and $3$. Call the number of such numbers $c$.

Then the number of bad numbers is $2b-c$, so our count is $a-2b+c$.

$\endgroup$
4
  • $\begingroup$ How can I visualise this with a Venn Diagram? $\endgroup$ – B.A. Apr 5 '14 at 6:51
  • 1
    $\begingroup$ The easiest is to let the "universe" be the numbers that are missing a $7$. Then draw two intersecting ovals $X$ and $Y$, where $X$ is represents the numbers in our universe that have no $2$, and $Y$ represents the numbers in our universe that have no $3$. We want to count the numbers in our universe that are outside $X\cup Y$. The number $2b-c$ counts $X\cup Y$. $\endgroup$ – André Nicolas Apr 5 '14 at 6:57
  • $\begingroup$ You are welcome. I am sure you can compute $a$, $b$, and $c$. For example $b=(7)(8^{n-1})$. $\endgroup$ – André Nicolas Apr 5 '14 at 7:13
  • $\begingroup$ Yep. I got 8*9^(n-1) - 2*7*8^(n-1) + 6*7^(n-1) $\endgroup$ – B.A. Apr 5 '14 at 7:20

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.