4
$\begingroup$

im studying previous math exams for my discrete math finals next week, no solutions are provided for past exams so i figured id try posting here.

Q: How many non-negative integers less than one hundred thousand, 100 000, contain at least one 2 and at least one 5?

A:

let $A$ be the set of all non-negative integers <100000 that do not contain a 2.

let $B$ be the set of all non-negative integers <100000 that do not contain a 5.

$$|A|=9^5$$ $$|B|=9^5$$ $$|A\cap B|=8^5$$

The number of non-negative integers <100000 that contain neither 2 or 5 is (by inclusion/exclusion): $$|A\cup B| = |A| +|B|-|A\cap B|$$ $$=9^5+9^5-8^5=85330$$

Thus, the number of non-negative integers <100000 that contain 2 and 5 is: $$100000-|A\cup B| =100000-85330=14670$$

$\endgroup$
  • $\begingroup$ This answer agrees with a brute-force calculation. $\endgroup$ – Misha Lavrov Jun 4 '18 at 4:58
  • $\begingroup$ I think we are going to be having exams together hehe.. (PW)(lukasz) Anyways, why is it to the power of 5 and not 6? $\endgroup$ – Mr Pro Pop Jun 4 '18 at 11:10
  • 1
    $\begingroup$ @MrProPop Any nonnegative integer less than $100,000$ can be represented as a string of length $5$ by appending leading zeros as needed. $\endgroup$ – N. F. Taussig Jun 4 '18 at 12:09
  • $\begingroup$ Your answer is correct. $\endgroup$ – N. F. Taussig Jun 4 '18 at 12:10
1
$\begingroup$

Assuming that the question you forgot to ask was “Is my solution correct?”: As has been stated in the comments, your solution is correct.

| cite | improve this answer | |
$\endgroup$

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.