A problem related to number theory How can I find out the number of multiples of a number in a given range. For example, if the range is $1$ to $15$, then the number of multiples of $2$, $3$, and $5$ are $7$, $5$, and $3$, respectively.
$M_2=\{2,4,6,8,10,12,14\}$
$M_3=\{3,6,9,12,15\}$
$M_5=\{5,10,15\}$
Is it possible to find out the number of multiples of a number without finding out all multiples in a given range? Is there any efficient method? If so, I need to know it and the reasoning behind it.

Let $n$ and $k$ be positive integers. We want to find the number of multiples of $k$ that are in the interval from $1$ to $n$. Imagine dividing $n$ by $k$.  There are integers $q$ and $r$, with $0\le r\le k-1$, such that $n=qk+r$.
The required number is $q$, since $qk\le n$ while $(q+1)k\gt n$. So $k,2k,\dots,qk$ are all the multiples of $k$ that are between $1$ and $n$, and there are $q$ of them. 
Note that $q=\left\lfloor \frac{n}{k}\right\rfloor$, where $\lfloor x\rfloor$ is the "floor" function. In general, $\lfloor x\rfloor$ is the greatest integer which is $\le x$. For example, $\lfloor 3.14\rfloor=3$. 
On a calculator, we find $\frac{n}{k}$ and throw away the part after the decimal point. For example, let us find the number of multiples of $7$ in the interval from $1$ to $1000$. The calculator gives, approximately, $\frac{1000}{7}\approx 142.85714$, so in this case $q=142$. 
