[Math] How many pairwise distinct sums are there in a finite set of consecutive Integers

combinatoricselementary-number-theorysummation

If $n>1$ is a positive integer Let $A_n =\{a_1,a_2,\ldots,a_n\}$ be a finite set of consecutive integers.

How many distinct sums of the form $a_j+a_k$ where $j \neq k$ are
there?

Surely there are ${n \choose 2}$ entries to select from $A_n$. So a naive answer would be that there are $1,3,6,10,\ldots$ possible sums for $n$ equal to $1,2,3,4,\ldots$ respectively. But that is wrong since the set $\{9,10,11,12\}$ has distinct sums: $9+10,9+11,9+12,10+12,11+12$ noting that $10+11=9+12$. So we have $5$ distinct sums and not ${4 \choose 2}=6$.

Here is my work and my approach so far:

If $a_j$ is any element in $A_n$ other than $a_1$ then $a_j=-1+j+a_1$. To see a working example of this just consider an $A_4=\{123,124,125,126\}$, then $a(3) = -1+3+123=-1+126=125$. I construct the following sets $S_{a_{j}}=\{a_j+a_k\text{ }|\text{ } j\neq k\}$. We need to compute $$\bigg|\bigcap_{j=1}^n S_{a_{j}}\bigg|$$ Surely $|S_{a_{1}}|=n-1$. I would like to use some type of inclusion-exclusion process to get rid of the sums that occur more than once.

Best Answer

You can solve this simply by looking at the smallest number you can form and the largest number you can form. Let's say $\{a_1, a_2, ..., a_n\}$ is ascending. Then let $x = a_1 + a_2$ be the smallest number you can form. Let $y = a_{n-1} + a_n$ be the largest number you can form. Then you can see that you can form every number in between $x$ and $y$ (Hint: You can shift the sequence $\{a_1, a_2, ..., a_n\}$ so that it looks like $\{1, 2, ..., n\}$). Therefore, you can create $y - x + 1$ distinct numbers. Looking at our shifted values, we can create $(2n-1)-(3)+1=2n-3$ distinct numbers.