Tuesday, February 12, 2019

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.


Answer



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}}$


No comments:

Post a Comment

analysis - Injection, making bijection

I have injection $f \colon A \rightarrow B$ and I want to get bijection. Can I just resting codomain to $f(A)$? I know that every function i...