# What is the probability that a positive integer not exceeding 100 selected at random is divisible by 5 or 7?

Q: What is the probability that a positive integer not exceeding 100 selected at random is divisible by $$5$$ or $$7$$?

Choosing a number from $$1$$ to $$100$$ divisible by $$5$$ is $$\frac{5}{100} = \frac{1}{20}$$

Choosing a number from $$1$$ to $$100$$ divisible by $$7$$ is $$\frac{7}{100} = \frac{1}{14}$$ (removing the decimals)

I now have to remove the two numbers $$35$$ and $$70$$. $$\frac{1}{50}$$

So I've got $$\frac{1}{20} + \frac{1}{14} - \frac{1}{50} = \frac{71}{700}$$.

The books answer is $$\frac{8}{25}$$. What am I doing wrong here?

• Hint: The probability of choosing a number $n$ that's divisible by $5$ selected uniformly randomly from $[1, 100]$ is $\frac15$. Nov 20 at 3:07
• There are 20 numbers divisible by 5, giving 20/100 i.e.1/5, instead of your try which was 1/20. The same type error was made for divisible by 7 Nov 20 at 3:22
• Well that's annoying. I guess I'm getting tired. Nov 20 at 3:26
• You want $$\frac{20 + 14 - 2}{100} = \frac{8}{25}.$$ Nov 20 at 3:27
• You can answer the question yourself, or you can delete the question. Nov 20 at 4:23

You almost got it. The amount of numbers between $$1$$ and $$100$$ that are divisible by some $$n$$ such that $$n \in \mathbb{Z}_{+}$$, is $$\lfloor \frac{100}{n} \rfloor$$ ($$\lfloor x \rfloor$$ denotes the floor function, which round any number down to the nearest integer, or as you say it, removes the decimals). Therefore the probability of choosing a number, divisible by $$n$$, between $$1$$ and $$100$$ is $$\frac{\lfloor \frac{100}{n} \rfloor}{100}$$. Therefore your steps should have followed as so

Event $$\mathcal{F_1}$$: Choosing a number from $$1$$ and $$100$$ divisible by $$5$$. $$P(\mathcal{F_1})= \frac{\lfloor \frac{100}{5} \rfloor}{100} = \frac{\lfloor 20 \rfloor}{100} = \frac{20}{100} = \frac{1}{5}.$$

Event $$\mathcal{F_2}$$: Choosing a number from $$1$$ and $$100$$ divisible by $$7$$. $$P(\mathcal{F_2}) = \frac{\lfloor \frac{100}{7} \rfloor}{100} = \frac{\lfloor 14 \rfloor}{100} = \frac{14}{100} = \frac{7}{50}.$$

It seems the answer is solving for the exclusive or (notation: $$\oplus$$), therefore we must account for intersection, $$35$$ and $$70$$, probability $$P(\mathcal{F_1} \cap \mathcal{F_2}) = \frac{2}{100} = \frac{1}{50}.$$

Therefore, $$P(\mathcal{F_1 \oplus F_2}) = P(\mathcal{F_1}) + P(\mathcal{F_2}) - P(\mathcal{F_1} \cap \mathcal{F_2}) = \frac{1}{5} + \frac{7}{50} - \frac{1}{50} = \frac{8}{25}.$$ Or simply notice that $$P(\mathcal{F_1 \oplus F_2}) = \frac{\frac{\lfloor \frac{100}{5} \rfloor}{100} + \frac{\lfloor \frac{100}{7} \rfloor}{100} - \frac{2}{100}}{100} = \frac{20 + 14 - 2}{100} = \frac{8}{25}.$$

Make sure that you at least check your cases. For example, when you say the probability for numbers divisible $$7$$ is $$\frac{7}{100}$$, you're claiming that are are $$7$$ numbers that are divisible by $$7$$ between $$1$$ and $$100$$. This can easily be disproven by just checking $$8$$ numbers. $$7, 14, 21, 28, 35, 42, 49, \text{and }56$$ are all divisible by $$7$$ and less then $$100$$.

• Thank you for the thorough explanation. Nov 21 at 2:01