|
Main Menu
Who's Online
There are 104 unlogged users and 0 registered users online.
You can log-in or register for a user account here.
Sponsored Links
|
Wednesday, February 27, 2008 - 01:28 PM
As inspired by Gauss's tale of impressive summation of all integers from 1 to 100, I set out to have a formula that would sum all the numbers between two numbers, inclusive.Formula:
![]() x is the smaller number of the two. y is the larger one. This formula CANNOT be used to add even or odd integers, However, it can be used to add negative and positive integers. To do so, cancel out the opposites and add the remaining numbers. Or, if you have, for example, one negative number and the rest are positive, then add the bigger group of numbers and then deal with remaining "odd man out". There are probably better formulas at this site, but I think that this formula has the advantage that it can be used quickly for huge numbers of integers, such as databases and arrays. |
User's Login
Sponsored Links
Other Stories
|
Comments