# Determine all integer pairs (x,y) with x < y such that the sum of all the integers strictly contained between then is equal 2016?

Sep 13, 2016

$\left(- 2016 , 2017\right) , \left(- 671 , 674\right) , \left(- 285 , 292\right) , \left(- 220 , 229\right) , \left(- 86 , 107\right) , \left(- 1 , 64\right) , \left(0 , 64\right) , \left(85 , 107\right) , \left(219 , 229\right) , \left(284 , 292\right) , \left(670 , 674\right) , \left(2015 , 2017\right)$

#### Explanation:

The sum of an arithmetic sequence, such as an unbroken sequence of consecutive integers, is equal to the number of terms multiplied by the average term, which is also the average of the first and last terms.

In our example, the number of terms is $y - x - 1$ and the average term is $\frac{x + y}{2}$

So we have:

$\left(y - x - 1\right) \left(\frac{x + y}{2}\right) = 2016$

So:

$\left(y - x - 1\right) \left(x + y\right) = 4032$

The prime factorisation of $4032$ is:

$4032 = {2}^{6} \cdot {3}^{2} \cdot 7$

So there are $\left(6 + 1\right) \left(2 + 1\right) \left(1 + 1\right) = 7 \cdot 3 \cdot 2 = 42$ positive integer factors:

If $x + y = n$ for one of these factors, then:

$y - x - 1 = \frac{4032}{n}$

So:

$x = \frac{1}{2} \left(n - \frac{4032}{n} - 1\right)$

$y = \frac{1}{2} \left(n + \frac{4032}{n} + 1\right)$

So the only additional requirement is that $n \pm \left(\frac{4032}{n} + 1\right)$ is even.

Hence one of $n$ and $\frac{4032}{n}$ is odd and the other even. Thus one must be a multiple of ${2}^{6}$ and the other odd.

Hence the possible values for $n$ are:

$1 , 3 , 7 , 9 , 21 , 63 , 64 , 192 , 448 , 576 , 1344 , 4032$

with corresponding $\left(x , y\right)$ pairs:

$\left(- 2016 , 2017\right) , \left(- 671 , 674\right) , \left(- 285 , 292\right) , \left(- 220 , 229\right) , \left(- 86 , 107\right) , \left(- 1 , 64\right) , \left(0 , 64\right) , \left(85 , 107\right) , \left(219 , 229\right) , \left(284 , 292\right) , \left(670 , 674\right) , \left(2015 , 2017\right)$