# Thread: Choosing pairs of numbers with a sum-bound

1. ## Choosing pairs of numbers with a sum-bound

Dear Forum,

I have the following question:

How can one write up a closed formula for computing the number of possible pairs of numbers in a set, whose sum is lees than or equal to a constraint?

For example: if we have the numbers from 1 to 100 what is the number of cases when the sum of the two numbers in a pair is less than 10. Here, the 1, 100 and 10 values are not important at all, I just wanted make it easier to demonstrate the problem. Of course, I would need a so called closed formula for that, I am not sure whether it exists. (Iterative solution is unfortunately not an option).

Any help would be appreciated!

Your sincerely,

Shinkansen

2. Let's denote what you called a "constraint" as $n$. Now, you can only make pairs of numbers $a_1$ and $a_2$, such that $a_1+a_2, when $a_1,a_2\in [1,n-2]$. Therefore, there are $n-2$ pairs you can make with $1$, $n-3$ pairs with $2$, $n-4$ pairs with $3$, ... , and $1$ pair with the $(n-2)$ number: $(n-2)+(n-3)+...+2+1=\frac{(n-2)(n-1)}{2}$ is the numbers of pairs you seek.