5
$\begingroup$

I used the Inclusion-Exclusion Principle and I got $200,000,000$ (multiples of $5$ less than $10^9$, obtained by $10^9 / 5$) + $124,857,142$ ( multiples of $7$ less than $10^9$, obtained by $10^9 / 7$ and round it down) - $28,571,428$ ( multiples of both $5$ and $7$ that are less than $10^9$, obtained by $10^9 / 35$ because only multiples of $35$ is multiple of both $5$ and $7$ ) since the rule says $|A ∪ B| = |A| + |B| - |A ∩ B|$.

So my equation is: $200,000,000 + 124,857,142 - 28,571,428 = 314,285,714 $, which is a rather big number so I think I might have done something wrong. Is my reasoning correct? Please help. Thank you!

$\endgroup$
  • 3
    $\begingroup$ It is 142857142 not 124857142. Otherwise your reasoning is correct, and this big number is normal. $\endgroup$ – Sean Lo Oct 16 '14 at 0:33
  • $\begingroup$ I see, thank you guys very much for helping out! $\endgroup$ – bodygued Oct 16 '14 at 0:36
5
$\begingroup$

Besides your transposed digit, everything you did is completely correct. The correct answer is indeed 314,285,714.
If you'd like to verify that your numbers are correct, I've wrote a little bit of pseudocode that should accurately show that the number you found is absolutely correct.

counter = 0
i = 0;
while i < 1000000000{
if i % 5 == 0 or i % 7 == 0 {
counter = counter + 1;
}
i = i + 1;
}

| 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.