# When is the sum of first $n$ numbers equal to the sum of the next $k$ numbers?

When is the sum $1+2+\cdots + n = (n+1) + (n+2) + \cdots +(n+k)$?

The easiest solution $(n,k)$ is $(2,1)$. For example, $1+2 = 3$. Do any others exist?

Roots of $(n+k)^2 + (n+k) = 2n^2 +2n$ give solutions (Is this solvable via a Pell equation?)

If a complete graph has red($n$) and blue($k$) nodes, and I pick an edge at random; the probability of picking one that connects two red vertices is $1/2$, find the number of blue and red nodes.

This may be trivial but I really have no clue so I ask the pros.

A (sort of) variation on the first problem of "Fifty Challenging problems in probability with solutions" Frederick Mosteller.

-
See slides 17--21 of the talk math.uconn.edu/~kconrad/ross2008/pelltalkOSU.pdf, which also discusses sums of consecutive integers with a gap (the second sum starting at $n+2$, for instance). – KCd May 11 '12 at 3:06

Write the equation $(n+k)^2+n+k = 2 (n^2 + n)$ as $(2n+2k+1)^2 - 2 (2n+1)^2 = -1$. Solutions to the Pell equation $x^2 - 2 y^2 = -1$ all have $x$ and $y$ both odd, so every such solution with $x$, $y$ positive gives a solution of your problem by $n=(y-1)/2$, $k=(x-y)/2$. The first few $(n,k)$ pairs are
$$\left[ \begin {array}{cc} 0&0\\ 2&1 \\ 14&6\\ 84&35 \\ 492&204\\ 2870&1189 \\ 16730&6930\\ 97512&40391 \\ 568344&235416\\ 3312554&1372105 \\ 19306982&7997214\end {array} \right]$$