TITLE: When is the sum of first $n$ numbers equal to the sum of the next $k$ numbers?
QUESTION [6 upvotes]: 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.

REPLY [13 votes]: 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] 
$$
{"set_name": "stack_exchange", "score": 6, "question_id": 143730}