Efficient Way of finding possible sums in equation I am looking for an efficient way to find the following numbers numbers $a, b$ 
Let $x$ be 63 (as example)
$$\sum_{k = a}^b k = \sum_{l = 1}^b l - \sum_{j=1}^{a-1} j = \frac{b*(b+1)}{2}-\frac{a*(a-1)}{2} = x = 63$$
in this case for example
$$63 = 8+9+10+11+12+13 = \sum_{k = 8}^{13} k $$
 A: Given positive integer $x$, you want positive integers $a,b$ such that 
$$ 2x = b(b+1) - a(a-1) $$
If $c = 2a-1$ and $d=2b+1$, this says
$$ (d-c)(d+c) = d^2 - c^2 = 8x $$
(with $c$ and $d$ both odd). 
So look at factorizations of $8x$.  If $8x = uv$ where $u$ and $v$ are positive integers, $u < v$,
we want $d-c = u$ and $d+c = v$, and then $d = (u+v)/2$, $c = (v-u)/2$.
Note that we can take $u \equiv 2 \mod 4$ and $v \equiv 0 \mod 4$ (or vice versa), and get $c$ and $d$ odd. 
In your example, $x=63$, $8x = 2^3 \times 3^2 \times 7$, and the solutions are:


*

*$u = 2$, $v = 252$, $c = 125$, $d = 127$, $a = 63$, $b = 63$

*$u = 6$, $v = 84$, $c=39$, $d=45$, $a = 29$, $b=22$

*$u = 14$, $v = 36$, $c=11$, $d=25$, $a = 6$, $b=12$

*$u = 18$, $v = 28$, $c=5$, $d=23$, $a = 3$, $b=11$

*$u = 12$, $v = 42$, $c=15$, $d=27$, $a = 8$, $b=13$

*$u = 4$, $v = 126$, $c=61$, $d=65$, $a = 31$, $b=32$

A: Expanding your sums, you have :
$$\frac{b^2+b}{2}-\frac{a^2-a}{2} = x$$
$$\iff (b+a)(b-a+1)=2x$$
Here, you have one of the two terms which is odd and then other even... Wait I guess that should be useful but..
The most obvious solution I see is :
$a = \frac{x-1}{2}, b=\frac{x+1}{2}$ but it will only work for an odd $x$.
But it's not really satisfying I guesS.
