Given a range [a, b], how to find the x middle numbers?

1k Views Asked by At

Given a range [$a$,$b$], how can I find the $x$ middle numbers?

For example:

[$1$,$10$]

Now I know that the middle $2$ numbers start with "$5$", but is there any way I can find the starting number, which in this case is "$5$", given a range doing some basic calculation$?$

3

There are 3 best solutions below

2
On

If you meant the middle point of the interval then it is $\;M:=\cfrac{a+b}2\;$ . Why? Because (check this)

$$(1)\;\;a\le M\le B\;\;,\;\;\;(2)\;\;M-a=b-M$$

In fact, (2) above is the explanation for the formula for $\;M\;$ in the first line.

0
On

If $a$ and $b$ are integers, and you want the $x$ integers closest to the centre of $[a,b]$, then these are $$\frac{a+b-x+1}{2},\frac{a+b-x}{2}+1,\ldots,\frac{a+b+x-1}{2}$$

assuming $a+b-x+1$ is even.

If $a+b-x+1$ is odd, then there is no unique solution. What are the two middle numbers in the range $[1,9]$, for instance?

0
On

Simply we can use this formula like when we know the range $$\frac{(a+ b)}{2}$$

simplicity is the best policy

It is a range so in this case you can use $$\frac{(b)}{2}$$

if range is an even number

Use $$\frac{(b+1)}{2}$$

if range is an odd number

Above will give you the nth term which is your middle value of range(a, b)