The Sum of Integers
The Sum_of_Integer() function, given n, returns the summation of the
consecutive integers from 1 to n:
Sum_of_Integer(n) = 1 + 2 + 3 + 4 + . . . + n
The sum can also be computed with the equation:
(n^2 + n)/2
which is illustrated below (for n = 5).
Back to The Joy of Six