[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Stupid Arithmetic Tricks

On Fri, Mar 29, 2002 at 12:57:45PM +0100, Erich Schubert wrote:
> > If I'm given a long column of one or two-digit numbers to add up (on
> > paper), I go down the ones column and strike out all complementary pairs
> Well, that's the trick how Gauss is said to have surprised his
> teacher... because he was so fast in calculating, his teacher gave him
> the task to add up all numbers from 1 to 100. Gauss just formed pairs
> that sum up to one hundred... some story often told in school here.
> Basically you apply some sorting before calculating. You'll soon start
> striking out 12, 32, 56, too. Know your nine there, too...

A little knowledge of series tells me to apply n*(n+1)/2 to sum an arithmetic
progression of common difference 1, starting at 1.  This seems even quicker:
100*101/2 becomes 5*101*10 becomes 505*10 = 5050.

; Matthew Danish <mdanish@andrew.cmu.edu>
; OpenPGP public key: C24B6010 on keyring.debian.org
; Signed or encrypted mail welcome.
; "There is no dark side of the moon really; matter of fact, it's all dark."

To UNSUBSCRIBE, email to debian-devel-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org

Reply to: