I was able to derive the formula for summing consecutive integers:
sum =n(n+1)2⟹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:
n2+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=n⋅(n+1)2|⋅2
2X=n2+n|−2X
1n2+1n−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
n1/2=−1±√1−4⋅(−2X)2=−1±√1+4⋅2X2
You need only the positive value.
Thus n1=n=−1+√1+8X2
No comments:
Post a Comment