Problem: Given any set $A = \{a_1, a_2, a_3, a_4\}$ of four distinct
positive integers, we denote the sum $a_1+a_2+a_3+a_4$ by $s_A$.
Let $n_A$ denote the number of pairs $(i,j)$ with $1 \le i < j \le 4$
for which $a_i + a_j$ divides $s_A$.
Find all sets $A$ of four distinct positive integers which achieve
the largest possible value of $n_A$.

Solution: There are two curves of solutions,
namely $\{x,5x,7x,11x\}$ and $\{x,11x,19x,29x\}$, for any positive integer $x$,
achieving $n_A = 4$ (easy to check).
We'll show that $n_A \le 4$ and equality holds only in one of the curves.

Let $A = \{a < b < c < d\}$.
\begin{claim*}
  We have $n_A \le 4$ with equality iff
  \[ a+b \mid c+d, \quad a+c \mid b+d, \quad a+d = b+c. \]
\end{claim*}
\begin{proof}
  Note $a+b \mid s_A \iff a+b \mid c+d$ etc.
  Now $c+d \nmid a+b$ and $b+d \nmid a+c$ for size reasons, so we already have $n_A \le 4$;
  moreover $a+d \mid b+c$ and $b+c \mid a+d$ if and only if $a+d = b+c$.
\end{proof}

We now show the equality curve is the one above.
\[ a+c  \mid b+d \iff a+c \mid -a+2b+c \iff a+c \mid 2(b-a). \]
Since $a+c > |b-a|$, so we must have $a+c=2(b-a)$.
So we now have
\begin{align*}
  c &= 2b-3a \\
  d &= b+c-a = 3b+c-4a.
\end{align*}
The last condition is
\[ a+b \mid c+d = 5b-7a \iff a+b \mid 12a. \]
Now, let $x = \gcd(a,b)$.
The expressions for $c$ and $d$ above imply that
$x \mid c,d$ so we may scale down so that $x = 1$.
Then $\gcd(a+b,a) = \gcd(a,b) = 1$ and so $a+b \mid 12$.

We have $c > b$, so $3a < b$.
The only pairs $(a,b)$ with $3a < 2b$, $\gcd(a,b) = 1$ and $a+b \mid 12$
are $(a,b) \in \left\{ (1,5), (1,11) \right\}$ which give the solutions earlier.