#### An interesting math formula to share

```Hi 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;'
5050
``` 0  ToddAndMargo
7/10/2018 9:02:45 AM perl.perl6.users  1146 articles. 0 followers. 7 Replies 59 Views Similar Articles

[PageSpeed] 47

```Hi Todd!

On Tue, 10 Jul 2018 02:02:45 -0700
ToddAndMargo <ToddAndMargo@zoho.com> wrote:

> Hi All,
>=20
> Remembering from my school days, a famous mathematician
> whose name I forget came up with a formula as a kid
> that made math history.
>=20

See https://en.wikipedia.org/wiki/Arithmetic_progression . They tell this s=
tory
about https://en.wikipedia.org/wiki/Carl_Friedrich_Gauss - see
http://www.coolmath.com/algebra/19-sequences-series/06-gauss-problem-arithm=
etic-series-01 ,
but the formula for that predates him by many centuries.

> 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.
>=20
> Seems he had discovered that if you laid the number
> out forward, then reverse underneath
>=20
> N=3D5
>=20
> 1 + 2 + 3 + 4 + 5 =3D 15
> 5 + 4 + 3 + 2 + 1 =3D 15
> ---------------------
> 6   6   6   6   6 =3D 30
>=20
> If you add the columns, you always got N+1 and N times.
> And that make the formula
>=20
>       1+2+3..N =3D (N+1)*N/2
>=20
> I always have fun recreating this formula from the
> forward and reverse tables added as columns.
>=20
> So feed the following an integer and have fun!
>=20
> Yup.  He blew his teacher's mind!
>=20
> -T
>=20
>=20
> \$ echo "5" | p6 'my \$N=3Dslurp(); say \$N*(\$N+1)/2;'
> 15
>=20
> \$ echo "6" | p6 'my \$N=3Dslurp(); say \$N*(\$N+1)/2;'
> 21
>=20
> \$ echo "100" | p6 'my \$N=3Dslurp(); say \$N*(\$N+1)/2;'
> 5050

--=20
-----------------------------------------------------------------
Shlomi Fish       http://www.shlomifish.org/
Chuck Norris/etc. Facts - http://www.shlomifish.org/humour/bits/facts/

I=E2=80=99d love to change the world, but they won=E2=80=99t give me the so=
urce code.
=E2=80=94 Unknown

Please reply to list if it's a mailing list post - http://shlom.in/reply .
``` 0  shlomif
7/10/2018 9:47:29 AM
```Hi!

On Tue, Jul 10, 2018 at 02:02:45AM -0700, ToddAndMargo wrote:

> Remembering from my school days, a famous mathematician
> whose name I forget came up with a formula as a kid
> that made math history.

https://en.wikipedia.org/wiki/Carl_Friedrich_Gauss

greetings,
domm

--
#!/usr/bin/perl                              http://domm.plix.at
for(ref bless{},just'another'perl'hacker){s-:+-\$"-g&&print\$_.\$/}
``` 0  domm
7/10/2018 9:55:03 AM
```On Tuesday, July 10, ToddAndMargo wrote:
> \$ 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;'
> 5050

Another cool thing is that this formula is used
in Perl 6 under the hood to calculate the sum of
the integers in a range instantly:

~ \$ time perl6 -e 'say [+] 1..100'
5050

real    0m0.213s
user    0m0.250s
sys     0m0.032s

~ \$ time perl6 -e 'say [+] 1..10000000000000000000'
50000000000000000005000000000000000000

real    0m0.198s
user    0m0.236s
sys     0m0.034s
``` 0  bduggan2
7/10/2018 10:42:50 AM
```On 07/10/2018 02:47 AM, Shlomi Fish wrote:
> Hi Todd!
>
> On Tue, 10 Jul 2018 02:02:45 -0700
> ToddAndMargo <ToddAndMargo@zoho.com> wrote:
>
>> Hi 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.
>>
>
> See https://en.wikipedia.org/wiki/Arithmetic_progression . They tell this story
> about https://en.wikipedia.org/wiki/Carl_Friedrich_Gauss - see
> http://www.coolmath.com/algebra/19-sequences-series/06-gauss-problem-arithmetic-series-01 ,
> but the formula for that predates him by many centuries.
>

"The" gauss!  I was an RF (Radio Frequency) Design Engineer
before becoming a computer consultant (couldn't find work
in RF Design after the end of the cold war with all the
outsourcing that occurred).  "Gauss" was a real big deal.
``` 0  ToddAndMargo
7/10/2018 8:53:42 PM
```On 07/10/2018 03:42 AM, Brian Duggan wrote:
> On Tuesday, July 10, ToddAndMargo wrote:
>> \$ 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;'
>> 5050
>
> Another cool thing is that this formula is used
> in Perl 6 under the hood to calculate the sum of
> the integers in a range instantly:
>
> ~ \$ time perl6 -e 'say [+] 1..100'
> 5050
>
> real    0m0.213s
> user    0m0.250s
> sys     0m0.032s
>
> ~ \$ time perl6 -e 'say [+] 1..10000000000000000000'
> 50000000000000000005000000000000000000
>
> real    0m0.198s
> user    0m0.236s
> sys     0m0.034s
>

Fascinating!

If I ever get bored and try to figure out
by hand how to do an inverse cosine, some
come smack me.
``` 0  ToddAndMargo
7/10/2018 8:55:49 PM
```Your saying "count all the number" is confusing and doesn't seem to relate to
what follows.  Did you mean to say "sum all the number"? -- Darren Duncan

On 2018-07-10 2:02 AM, ToddAndMargo wrote:
> Hi 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;'
> 5050
>
``` 0  darren
7/11/2018 4:25:37 AM
```> On 2018-07-10 2:02 AM, ToddAndMargo wrote:
>> Hi 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.=C2=A0 It took him only a few minutes.=C2=A0 They thought
>> he cheated, so they sent him back with an even larger
>> number to add up.=C2=A0 Same couple of minutes.=C2=A0 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=3D5
>>
>> 1 + 2 + 3 + 4 + 5 =3D 15
>> 5 + 4 + 3 + 2 + 1 =3D 15
>> ---------------------
>> 6=C2=A0=C2=A0 6=C2=A0=C2=A0 6=C2=A0=C2=A0 6=C2=A0=C2=A0 6 =3D 30
>>
>> If you add the columns, you always got N+1 and N times.
>> And that make the formula
>>
>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 1+2+3..N =3D (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.=C2=A0 He blew his teacher's mind!
>>
>> -T
>>
>>
>> \$ echo "5" | p6 'my \$N=3Dslurp(); say \$N*(\$N+1)/2;'
>> 15
>>
>> \$ echo "6" | p6 'my \$N=3Dslurp(); say \$N*(\$N+1)/2;'
>> 21
>>
>> \$ echo "100" | p6 'my \$N=3Dslurp(); say \$N*(\$N+1)/2;'
>> 5050
>>

On 07/10/2018 09:25 PM, Darren Duncan wrote:
> Your saying "count all the number" is confusing and doesn't seem to
> relate to what follows.  Did you mean to say "sum all the number"? --
> Darren Duncan
>

Yes, sum them.

N=3D5 would be 1+2+3+4+5

--=20
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Computers are like air conditioners.
They malfunction when you open windows
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
``` 0  ToddAndMargo
7/11/2018 6:13:26 AM