Following in Gauss's footsteps : Computing the Sum of the First n Positive Integers
What if we want to compute the following sums for which $n$ is a positive integer. $$ \sum_{k=1}^{n} k = 1+2+3+\cdots+n $$ $$ \sum_{k=1}^{n} k^2 = 1^2+2^2+3^2+\cdots+n^2 $$ $$ \sum_{k=1}^{n} k^3 = 1^3+2^3+3^3+\cdots+n^3 $$ You can just power your way through it by brute forcing this sum, but for a large amount of $n$ this might become very difficult. Maybe there is something smarter we can do right? Well, the same thought went through Gauss’s head. Gauss, the mathematical prodigy Germany in the $1780$s, a bunch of children are sitting in a classroom. The teacher just gave the entire class the tedious assignment of summing the first $100$ integers. In other words, he wanted the children to compute: $$ \sum_{k=1}^{100} k = 1+2+3+\cdots+100 $$ The teacher hoped that this exercise would keep the kids busy for half an hour, but a young Gauss was quick to answer that the sum’s value is $5\,050$. This was only a glimpse of the pure genius of Gauss. However, he was no literal ...