freebunny
This may sound a very very stupid question, but I want to ask, how do you figure out multiples of 2 and 5 in a given range? Like you have mentioned:
Multiples of 2 in the range 0-1000, not inclusive - \(\frac{998-2}{2}+1=499\);
Is there any formula for this? Or is it just some logic that I am unable to figure out?
\(Number \ of \ multiples \ of \ x \ in \ the \ range = \)
\(=\frac{Last \ multiple \ of \ x \ in \ the \ range \ - \ First \ multiple \ of \ x \ in \ the \ range}{x}+1\).
Example 1: how many multiples of 5 are there between -7 and 35, not inclusive?
Last multiple of 5
IN the range is 30;
First multiple of 5
IN the range is -5;
\(\frac{30-(-5)}{5}+1=8\).
Example 2: How many multiples of 4 are there between 12 and 96, inclusive?
\(\frac{96-12}{4}+1=22\).
Example 3:How many multiples of 7 are there between -28 and -1, not inclusive?
Last multiple of 7
IN the range is -7;
First multiple of 7
IN the range is -21;
\(\frac{-7-(-21)}{7}+1=3\).