From: | Indianer45@***.net (Andy D Pfister) |
---|---|
Subject: | OT: Math Nazi is ME! |
Date: | Wed, 02 Mar 2005 10:42:08 +0100 |
>> > >There's no nice mathematical shorthand for the sum up to n, but you
>> can
>> > >also write it as (n^2 + n) / 2.
>
>
> Actually, I believe that is only an approximation.
>
> I am not sure whether it does not work with very small or very large
> numbers.
>
<snipped>
It is exact for all Natural Numbers and 0, here's the Proof:
You write down the Numbers from 1 to n (assuming you want to add up to
n) in a line. Then, in a line underneath, you write it up again, but
backwards, starting with n, so now it looks like this:
1 2 3 4 ... n-1 n
n n-1 n-2 n-3 ... 2 1
If you add all these up, you get the double of what you where looking
for.You add the upper number with the number directly under it, which
gives you n+1 each time:
(1+n)+(2+n-1)+...+(n+1)
since each line has exactly n elements is equal to:
(n+1)n
You're looking for the half of that, so divide by 2, and you get:
(n+1)n/2 = (n^2+n)/2
The proof for zero is: (0^2+0)/2=0
-- Andy