# Finding the maximum possible number of elements of a set of real numbers

Let $0<b < a$ be two given real numbers. Consider a set of real numbers which satisfies the following conditions:

1. Each number in the set is strictly greater than $0$ but less than or equal to $b$.

2. The summation of all numbers in the set is equal to $a$.

3. The summation of each pair of numbers in the set is strictly greater than $b$.

What can we tell about the maximum number of elements of such a set? For example, for $a=2$ and $b=1$ at most $3$ elements are possible to assign to such a set (e.g., $\{0.5,0.7,0.8\}$ or $\{0.2,0.9,0.9\}$ etc.).

We can order the numbers $x_i$ in this set as $$0<x_1\leq x_2 \leq\ldots\leq x_n\leq b\ .$$ Since the $x_i$ sum to $a$ we have $$(n-1)x_2\leq x_2+x_3+\ldots+x_n=a-x_1\ ,$$ hence $$n\leq{a-x_1\over x_2}+1\ .$$ The condition $x_1+x_2>b$ implies $-x_1<x_2-b$ and $x_2>{b\over2}$. We therefore obtain $$n<{a-b+x_2\over x_2}+1={a-b\over x_2}+2<{a-b\over b/2}+2={2a\over b}\ .$$ On the other hand the resulting bound $n_*=\lceil 2a/b\rceil-1$ is optimal and can be attained with equal pieces of size slightly larger than ${b\over2}$.
All but one or all the x from the set are greater than $b/2$. Number of elements $n$ can be odd or even.
If $n$ is odd you can always group elements in pairs so that smallest be paired and largest be unpaired. Each pair is greater than b and the unpaired is greater than b/2. So their sum is greater than $nb/2$ meaning $a>nb/2$. Same is for even $n$.
Maximum number is $n= c[2a/b]-1$ where c[k] denotes smallest integer greater or equal to k
Obviously larger $n$ doesn't satisfy $a>nb/2$, just have to prove that there always exists such set.
You can always pick $x_i$ such that $x_i=b/2+\frac{a-nb/2}{n}+i\frac{a-nb/2}{n^2}$ where $i\in Z$, $|i|\le n/2$ and if $n$ is even than $i\ne0$. So $\sum x_i=a$