The story goes that when Carl Friedrich Gauss (1777–1855) was 10 years old, his teacher gave the pupils in an arithmetic class the problem of summing the integers from 1 to 100. Gauss came up with the answer almost immediately: 5050. He had found it by noting that the sum consists of 50 pairs of numbers, where each pair sums to 101.
In effect, Gauss had discovered a simple method for summing an arithmetic sequence (or arithmetic progression). In an arithmetic progression, each term is calculated from the previous one by adding (or subtracting) a constant value. To get the sequence’s sum, multiply the number of terms by the average of the smallest and largest terms.