When the teacher asked his 7-years old pupils (among them was also Carl Friedrich Gauss, mathematical genius) what is the sum of all numbers from 1 to 100, he was astonished that Gauss gave him the answer only after three seconds.
The sum is 5050, he said almost instantly.
He came to this extremely quickly noticing that we have 50 pairs of numbers which give the sum of 101:
- 100 + 1 = 101
- 99 + 2 = 101
- 98 + 3 = 101
- 51 + 50 = 101
So, 50 * 101 = 5050
Together with Archimedes and Newton they are known as Triumvirate of Mathematics and Gauss algorithms were widely used everywhere, especially at Wall Street.