How to solve for an unknown upper bound in a summation I've always wondered: if you have something like 
$$
\sum\limits_{k=0}^x k
$$
And you want to find x such that the value of the summation is the closest to a constant c, how would you proceed?
And is the summation is, in general,
$$
\sum\limits_{k=a}^{a+x} f(k)
$$
Is there anyway to proceed?

for the first sum you can use the formual $\sum_{k=0}^{x}k=\frac{1}{2}x(x+1)$
