My programming has rarely delved into maths. I was wondering though if people in the bar have any equations which they like and can explain.
Here is an example, how would you get the sum of all the integers from 1...10 inclusive?
Obviously you can use a quick loop, however;
1 + 10 = 11
2 + 9 = 11
3 + 8 = 11
4 + 7 = 11
5 + 6 = 11
6 + 5 = 11
7 + 4 = 11
8 + 3 = 11
9 + 2 = 11
10 + 1 = 11
=== (sum the above)
110
As you can see 110 is going to be twice the number we are looking for so the sum of the integers between 1...10 inclusive is 55.
This gives the equation S = (n+1) x n / 2 where n is as big a positive integer as you like, a lot better than using a loop, and you can 'see' that it will work for all integers.
Anybody got any more neat examples with an explanation?

