How many connections are possible between $n$ points, with a maximum distance of $m$? How many connections are possible between $n$ points, with a maximum distance of $m$? I really don't know about the technical terms of combinatorics, but here the distance is defined as how many unit-length it covers when joining another point. So when a point joins an adjacent point, the distance will be 1. When it joins a point situated just after it's adjacent point, then the distance will be 2, so on. 
And also the points are all in a line, not scattered around and the distance between each points are 1. So for $n$ points and a maximum distance the points are allowed $m$, how many connections are possible?
So the points are allowed to go 1,2,...m.
 A: If $n \leq m$, then every pair of points can be connected, so the answer is
$$
\binom{n}{2} = \frac{n^2 - n}{2}.
$$
If $n > m$, then maybe not every pair of points can be connected. In this case, split the points into the first $m$ points, and the $n-m$ points afterwards. The first $m$ points are all pairwise connected, for a total of $(m^2 - m)/2$ connections. Meanwhile, all points after those first $m$, which are $n - m$ in total, each have connections to $m$ points before them. This counts all connections precisely once, for a total of
$$
(m^2 - m)/2 + m(n-m) = \frac{2mn - m^2 - m}{2}.
$$
A: There are $n-1$ pairs of points with distance $1$, $n-2$ pairs with distance $2$, and so on up to $n-m$ pairs with distance $m$. The total number of valid connections is the sum of these numbers: $$\begin{align}\sum_{i=n-m}^{n-1}i&=\sum_{i=1}^{n-1}i-\sum_{i=1}^{n-m-1}i\\&=\binom n2-\binom {n-m}2\end{align}$$
This can also be expressed as $$\frac{m(2n-m-1)}{2}$$ which is equivalent to the earlier answer.
