Return the sum of all numbers from 1 to n. code example
Example 1: sum of all n integers
Sum of n integers 1 + 2 + 3 + ... + n = n * (n + 1) / 2
Example 2: formula for sum of n numbers
Sum of the First n Natural Numbers. We prove the formula 1+ 2+ ... + n = n(n+1) / 2, for n a natural number