How many sequences of consecutive integers are there where the sum equals the length I am really sad and I noticed that the sequence:
$0 , 1 , 2$
Has its sum equal to its length.
I was wondering how many these existed.
e.g:
$ 1$
$-3 , -2 , -1 , 0 , 1 , 2 , 3 , 4 , 5$  $(= 9)$
I got so far and got stuck, I reduced it down to finding out how many solutions there are to the equation:
$m^2 - n^2 + m + n = 0$   ,  $0 < n < m$ 
Can anyone tell me how to find this out?
 A: The sum of $0 + 1 + 2 + \ldots + (n-1)$ is $\frac{n(n-1)}{2}$ (and has length $n$) so the sum of any length $n$ sequence of consecutive integers starting at $m$ is $nm + \frac{n(n-1)}{2}$ (since such sequences are of the form $m+0,m+1,m+2,\ldots,m+(n-1)$) and we need to solve the diophantine equation $$nm + \frac{n(n-1)}{2} = n.$$
We should cancel $n$ and double it to get $2m + n = 3.$ This equation will only have solutions for odd $n$, this tells us there are no even length sequences with that property. On the other hand if $n$ is odd, there is exactly one such sequence.

n | m  | 2m+n  | sequence
-------------------------
1 | 1  | 3     | 1
2 | impossible... 
3 | 0  | 3     | 0 1 2
4 | impossible...
5 | -1 | 3     | -1 0 1 2 3
6 | impossible...
...

A: The sum of a nonempty sequence of numbers is equal to its length if and only if the average of its terms is $1$. The average of a sequence of consecutive integers is an integer if and only if the length of the sequence is odd, in which case it is the middle term of the sequence. So you are looking at the set of all odd-length sequences of successive integers whose middle term is $1$; these are easy to list, and there are infinitely many of them. Don't forget the empty sequence, which also qualifies.
A: You can factor it as $(m-n+1)(m+n)=0$.  The right factor is positive, so you must have $m+1=n$.  This violates your last inequality.
However, if you have the numbers running from $-n$ to $m$ the correct expression is $\frac 12(m^2+m) - \frac 12 (n^2+n)=m+n+1$ which yields $m^2-m-n^2-3n-2=0$
