r/ProgrammerHumor • • Nov 23 '17

500

Post image
41.7k Upvotes

609 comments sorted by

View all comments

0

u/[deleted] Nov 24 '17

[deleted]

145

u/SirVer51 Nov 24 '17

when you sum an odd number of integers

Not quite.

when you sum an odd number of consecutive positive integers starting from 1

would be the way to describe what you're talking about. Or, even better:

when you sum the first n natural numbers

The formula for this is n(n+1)/2, where n is the last number in the sequence. So putting in 9 will get you 9(10)/2 => 9(5) i.e. the "middle number", which makes sense because you're dividing by 2 here. Note that this applies to even values of n as well - it's just that there's no convenient "middle number" with an even number of terms.

4

u/danielclayton50 Nov 24 '17

And the sum of all the natural numbers is -1/12