News9 mins ago
(S)Um Of Consecutive Integers
10 Answers
This formula is intended to find the sum of a consecutive series of integers between any two values.
It appears to work for both positive and negative integers including series that include zero as one of the values.
Definition of variables:
(G)reatest minus (L)east plus 1 gives (N)umber of integers in series
( G + L ) / 2 gives (A)verage value
Formula:
[ ( G - L ) + 1 ] * [ ( G + L ) / 2 ] = N * A = S
Can this formula be simplified?
Feel free to suggest alternative methods for achieving this goal.
Thanks!
Answers
Best Answer
No best answer has yet been selected by mibn2cweus. Once a best answer has been selected, it will be shown here.
For more on marking an answer as the "Best Answer", please visit our FAQ.The sum in question is simply an arithmetic progression with common difference 1, so I don't think there's much more that needs to be done than quote that formula (in your notation):
S = N / 2 ( G + L )
This explains why it works including zero as one of the values. I also don't think that any simplification is possible - I suppose you could, say, eliminate G so that
S = N / 2 [( N - 1 ) + 2*L ]
Which also makes a neat connection to the related triangle numbers, as in that case L=1 so that S = N(N+1)/2 is the standard formula.
For the avoidance of any doubt, in this case I am using / in the sense I was describing in the R&S thread, so that N / 2 ( G + L ) implies that N is divided by 2 only
S = N / 2 ( G + L )
This explains why it works including zero as one of the values. I also don't think that any simplification is possible - I suppose you could, say, eliminate G so that
S = N / 2 [( N - 1 ) + 2*L ]
Which also makes a neat connection to the related triangle numbers, as in that case L=1 so that S = N(N+1)/2 is the standard formula.
For the avoidance of any doubt, in this case I am using / in the sense I was describing in the R&S thread, so that N / 2 ( G + L ) implies that N is divided by 2 only