Formula for adding all positive integers in a given interrval?

Click For Summary
The discussion centers on finding a formula to sum all even integers within a specified interval, such as from 6 to 2000. A participant mentions deriving a generalized equation that does not require knowing the total number of integers to be summed, unlike traditional arithmetic series formulas. The conversation highlights that the sum of even integers can be viewed as a specific case of an arithmetic series, with a constant difference of two. Another participant provides a more general formula for arithmetic sums, suggesting that it can be adapted for even integers. The derived formulas could be particularly useful for algorithms when the number of integers is unknown.
sherrellbc
Messages
83
Reaction score
0

Homework Statement

I meant for the title to be, Sum of all EVEN integers
A formula to add all even integers between two given points.
(i.e.) All integers from 6 to 2000 ?
6+8+10+12 .. + 2000

The Attempt at a Solution


The reason I ask is because I derived such an equation that will work for any integer interval. Just curious to see what any similar formula would look like.

Surely there is something like this.
 
Last edited:
Physics news on Phys.org
sherrellbc said:

Homework Statement




I meant for the title to be, Sum of all EVEN integers
A formula to add all even integers between two given points.
(i.e.) All integers from 6 to 2000 ?
6+8+10+12 .. + 2000

The Attempt at a Solution


The reason I ask is because I derived such an equation that will work for any integer interval. Just curious to see what any similar formula would look like.

Surely there is something like this.

Surely there is. It's just the sum of an arithmetic series. See https://en.wikipedia.org/wiki/Arithmetic_progression
 
Dick said:
Surely there is. It's just the sum of an arithmetic series. See https://en.wikipedia.org/wiki/Arithmetic_progression

Interesting. The Arithmetic series illustrates on this page is pretty much exactly what I derived, although mine being for a special case of the constant difference being two.

The difference being that the equations given on the Wiki article assume that you know how many integers you are adding together; the formula I derived does not. I simply expanded on this notion of needing to know the total number of integers to add and derived a generalized form of it. So, that being said, its already exists. Anyway, here is what I came up with. Given a closed interval [a,b] of positive integers, the sum is nothing more than:
RCJXDuD.jpg
 
This could be extensively useful in algorithms. Perhaps you are not aware of the length of Integers to add.

Albeit very specific, the formula could be useful.
 
If you look further down, there's the more general formula for an arithmetic sum where the difference between each value is d (in your case, 2)

S_n = \frac{n}{2}\left(2a+(n-1)d\right)

With d=2 we get

S_n = \frac{n}{2}\left(2a+2n-2\right)

=n(a+n-1)

But if you want the formula to be in terms of only the first and last values of the series, then you'll get to the result you've shown.
 

Similar threads

  • · Replies 16 ·
Replies
16
Views
2K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 17 ·
Replies
17
Views
2K
  • · Replies 20 ·
Replies
20
Views
2K
  • · Replies 10 ·
Replies
10
Views
2K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K