You all had this experience at least once. You have to calculate the sum of all numbers to n, so naturally you start counting and counting, starting all over again because you made a mistake and finally using a calculator to get the answer. Well I don’t want to ruin your day but you did everything wrong. There’s a much simpler way to do this. Here’s how:
Formula to calculate sum of all numbers from 0 to n:
This equation will output the sum of all natural numbers from to n. Just multiply the biggest numbers with the same number + 1 and then divide that by 2. That’s how you can get the sum.
But what if you want to calculate the sum of all number from let’s say 5 to 36. This time, we don’t start with 1 but the equation is similar.
This will output the sum of the numbers from k to n including k.#
Example:
Sum from all numbers from 1 to 64:
Sum from all numbers between 24 and 105:
As you can see it is much easier to use this formula than to go trough each number and it also takes less time! Are you interested in more? Click here!