# Help me test a modified formula for any consecutive (positive?) integers

## Recommended Posts

So I am not sure if it was that I was applying the formula found on Wikipedia incorrectly, (if so hahaha) https://en.wikipedia.org/wiki/Summation but I developed a formula based off several similar ideas that, so far, has proven to work for all consecutive positive integers, I have not begun testing whether it is accurate with negative integers, or complex numbers (Though I would imagine that it would work with complex numbers because you calculate those very similarly to integers, but you follow special rules for them when they have exponentation etc.)

\usepackage{asmmath}\displaymath:$\sum_k^n=((n-k)+1)(\frac{n-k}{2}+k)$

As there is almost certainly a formula that someone somewhere has come up with for fast summation I obviously lay no claim to this, (beyond that this is very simple math) but I have not been able to find such a formula.

The equation as so far I have tested works by taking the range, adding 1 to get the number of numbers, and multiplying it by the median, which can be found by dividing the range of your set by two and then adding it to the least in your set. I imagine that this could be refined in some way to allow for finding the sums of non-consecutive sets such as 129+201+899 and so on and so forth, and I am currently working on a formula that will work with any set of integers positive or negative, consecutive or non-consecutive.

Edited by Javier DeMoncello
LaTeX issue
##### Share on other sites

Logically, your equation should work fine.  It is mathematically equivalent to multiplying the number of elements in the sequence by the mean number of the sequence, which always gives the sum.  To see why, lets look at this set:  1, 2, 3, 4, 5, 6, 7, 8, 9, 10.  To get the sum we could add 10+1, then 9+2, then 8+3, 7+4, 6+5.... all of which add to 11.  The mean of the sequence is 5.5, which is just (10+2)/2.  If we multiply this mean by the quantity of numbers in the set (10) we get 55, which is the sum of 10+1, 9+2, 8+3, 7+4 and 6+5.  The equation that corresponds to my example is ((n+k)/2)(n-k+1), and your equation can be manipulated to match this equation.

##### Share on other sites

Standard formula would be n(n+1)/2 -k(k-1)/2.

## Create an account

Register a new account