How do you find the number of multiples of a given range of numbers?
I know this sounds a bit stupid but this question always confounds me. Say that you are given a range of numbers like $20$-$300$. And it asks you to find how many multiples of $5$ are given in that range. How would you proceed? What would the answers be for inclusive and exclusive numbers?
$20=5\times 4$ and $300=5\times 60$. So it has from $4$th multiple to $30$th. Thus including $20$ and $300$ it has $60-4+1=57$ multiples. If suppose instead of $300$, you had $x$ on the end where $x$ is not a multiple of $5$ then you just take first multiple of $5$ when you start walking left on integer line from $x$, i.e. if $x=304$, you replace it by $300$ again. similarly for non multiple on beginning, but now walk right.
Hint Count all the numbers such that they end in either a $5$ or a $0$. For the numbers $0-30$ inclusive that is $7$ numbers.
This may be logically equivalent to Bhaskar Vashishth’s answer, but IMNSHO this is clearer.
- Figure out how many multiples of $5$ there are between $0$ and $300$. Hint: $\frac{300}5$ may have something to do with this.
- Figure out how many multiples of $5$ there are between $0$ and $20$.
- Subtract result 2 from result 1.
In general one possible thing to do is the following:
rearrange the first and the last number (as in Bhaskar Vashishth's response) so that they are multiples of the number $n$ you want to count multiples of (5 in this case).
Then substract the two numbers, divide by $n$ and add one to get the inclusive answer