5

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!

Bruce Zheng
  • 1,039
  • 5
  • 11
bodygued
  • 297

1 Answers1

5

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;
}

Brad
  • 100