From:

Date:

July 10, 2018 09:02Subject:

An interesting math formula to shareMessage ID:

873d1025-2a4d-b871-4c94-a4fbbe12641a@zoho.comHi All, Remembering from my school days, a famous mathematician whose name I forget came up with a formula as a kid that made math history. As it transpires, when in school, they disciplined him by making his count all the number from 1 to some large number. It took him only a few minutes. They thought he cheated, so they sent him back with an even larger number to add up. Same couple of minutes. Blew his teacher's minds every number they gave him. Seems he had discovered that if you laid the number out forward, then reverse underneath N=5 1 + 2 + 3 + 4 + 5 = 15 5 + 4 + 3 + 2 + 1 = 15 --------------------- 6 6 6 6 6 = 30 If you add the columns, you always got N+1 and N times. And that make the formula 1+2+3..N = (N+1)*N/2 I always have fun recreating this formula from the forward and reverse tables added as columns. So feed the following an integer and have fun! Yup. He blew his teacher's mind! -T $ echo "5" | p6 'my $N=slurp(); say $N*($N+1)/2;' 15 $ echo "6" | p6 'my $N=slurp(); say $N*($N+1)/2;' 21 $ echo "100" | p6 'my $N=slurp(); say $N*($N+1)/2;' 5050Thread Next

**An interesting math formula to share**by ToddAndMargo- Re: An interesting math formula to share by Darren Duncan
- Re: An interesting math formula to share by ToddAndMargo
- Re: An interesting math formula to share by Brian Duggan
- Re: An interesting math formula to share by ToddAndMargo
- Re: An interesting math formula to share by Shlomi Fish
- Re: An interesting math formula to share by ToddAndMargo
- Re: An interesting math formula to share by Thomas Klausner

nntp.perl.org: Perl Programming lists via nntp and http.

Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About