# Last Value of an Arithmetic Sequence of a Particular Sum

I was able to derive the formula for summing consecutive integers:

sum $= \dfrac{n(n + 1)}{2} \Longrightarrow n = 4$, sum $= 10$

Nothing difficult there, but then I would like a formula for giving me the length/end point of an arithmetic sequence, starting with $1$, for a known sum of that sequence. I have tried, but my algebra skills are very rusty.

I have so far, for a sum of $10$, this:

$n^2 + n = 20$

What is the formula for finding the length of, or end point of, an arithmetic sequence, given the sum? If the sum is $10$, I would like the formula to return $4$. If the sum is $561$, then it should return $33$.

Thank you.

The equation has to be rearranged. Let X the sum. The equation is

$X=\frac{n\cdot (n+1)}{2} \quad | \cdot 2$

$2X=n^2+n \quad | -2X$

$\color{red}1n^2+\color{red}1n\color{red}{-2X}=0$

Solving for n. Applying the quadratic formula for solving a quadratic equation.

The values for the parameters are: $a=1$, $b=1$ and $c=-2X$

$n_{1/2}=\frac{-1\pm \sqrt{1-4\cdot (-2X)}}{2}=\frac{-1\pm \sqrt{1+4\cdot 2X}}{2}$

You need only the positive value.

Thus $n_1=\boxed{n=\frac{-1+ \sqrt{1+8X}}{2}}$

• Thank you. I cannot up vote, as not enough rep., but I appreciate the answer, but also the point in the direction of the quadratic formula. I am vaguely familiar with it, but will be more so by tomorrow. Thanks again. – JayJay123 Jun 8 '15 at 2:24
• @JayJay123 You are welcome. I colored the values of the parameters a, b and c. I hope it helps. – callculus Jun 8 '15 at 2:35