Calculate how many line segments can be formed by n points on a straight line using n×(n−1)÷2.
Minimum 2 points. Large values may produce very large outputs.
A line segment is determined by choosing two distinct points. So the count is the number of ways to choose 2 points from n points: