# Triangle-ish Number Series

Before I grind some algebra I was wondering if there was a known equation for a series of the form:

$$(x-y)+(x-2y)+(x-3y)+\dots+(x-ny) = T$$

Also a variant:

$$T-(q+y)-(q+2y)-(q+3y)-\dots-(q+ny) = 0$$

The first goes from $0$ to $T$ and the second from $T$ to $0$.

$x$, $y$, and $T$ are known for each instance, but change with each instance.

-
These are sums of arithmetic progressions, so yes, there are standard formulas. – André Nicolas May 10 '12 at 3:53
$T$ is not the same in those two expressions, and if they are then $q=x-(n+1)y$ – Kirthi Raman May 13 '12 at 22:15

Answer changed to match corrected problem statement:

It really does just require knowledge of the formula for the triangular numbers:

\begin{align*} (x-y)+(x-2y)+\ldots+(x-ny)&=nx-y(1+2+\ldots+n)\\ &=nx-y\cdot\frac{n(n+1)}2\\ &=n\left(x-\frac{n+1}2y\right)\;, \end{align*}

and

\begin{align*} T-(q+y)-(q+2y)-\ldots-(q+ny)&=T-\Big(nq+y(1+2+\ldots+n)\Big)\\ &=T-\Big(nq+y\cdot\frac{n(n+1)}2\Big)\\ &=T-n\left(q+\frac{n+1}2y\right)\;. \end{align*}

-
Bah, went ahead and ground it out... First... $(nx)-((y)*(((n)*(n-1))/2))$ Second... $T-(nq)-((y)*((n*(n-1))/2))$ – Char May 10 '12 at 3:53
@Char: That should be $(n-1)x$ in the first and $(n-1)q$ in the second. – Brian M. Scott May 10 '12 at 4:03
When I plug the numbers I get the results I am looking for without your (n-1) edits? Plus your eq gives unequal solutions for the same values. Try, T=900, x=380/3, and y=20/3,q=220/3. – Char May 10 '12 at 5:04
@Char: Sorry, that was a typo: those should have been $n+1$, as in my answer. If you used $nx$ in the first one, you got the wrong answer: there are $n+1$ $x$ terms, not $n$ of them. – Brian M. Scott May 10 '12 at 5:05
You try the values I suggested? – Char May 10 '12 at 5:12