Questions of division formulas and their origin Hi guys I came across a few neat formulas to calculate the number of intergers in an interval divisable by another integer!
I was wondering why does it work? what's the mathematics behind them?
If for example I want to find the number of integers between 99 and 993 that are divisable by 2
I can do the following, choose the highest number divisable by x and the lowest number divisable by x and then
$\frac{\left(992-100\right)}{2}+1=447$ 
and also I can do
$⌊\frac{993-99}{2}⌋=447$
in the case of the floor fucntion if 2 is to divide both the upper and lower bound I would add 1 to the result!
Thank you so in advance guys!
You showed an example but not the original formula with variables but$\cdots$
If you mean how many numbers between $x$ and $y$ are divisible by $z$, the answer is that every $z^{th}$ number will be a multiple of $z$. for example, between $1$ and $21$ how many numbers will be divisible by $z$? Those numbers will be $3,6,9,12,15,18,21\quad$ seven.
In the &quot;formula&quot;,
$$\bigg\lfloor\frac{21-1}{3}\bigg\rfloor=6\qquad\bigg\lceil\frac{21-1}{3}=7\bigg\rceil$$
however
$$\bigg\lfloor\frac{22-1}{3}\bigg\rfloor=7\qquad\bigg\lceil\frac{22-1}{3}=7\bigg\rceil$$
and
$$\bigg\lfloor\frac{23-1}{3}\bigg\rfloor=7\qquad\bigg\lceil\frac{23-1}{3}=8\bigg\rceil$$
I would say the formula is good for a estimate, $\pm1$.
If you choose  $0$ as the lowest number divisible by $z$ then you need no rounding but, for instance, between $10$ and $20$ where $12,15,18$ are divisible by $3$ we are &quot;off&quot; again
$$\frac{18-12}{3}=\frac{6}{3}=2$$
This formula is based on arithmetic progression.
Consider the interval $[a,b]$ and suppose $x,y$ are respectively the smallest and largest numbers divisible by $k$ in this interval.
Note that the multiples of $k$ in this interval would be
$$x,x+k,x+2k,\cdots x+(n-2)k,y$$
where $y=x+(n-1)k$ is the $nth$ multiple of $k$ in this interval. We are required to find $n$
A simple rearrangement of $y=x+(n-1)k$ would yield $n=\frac{y-x}{k}+1$ which is the formula you have used