Re: fastest way to add up a billion numbers
- To: mathgroup at smc.vnet.net
- Subject: [mg73898] Re: [mg73880] fastest way to add up a billion numbers
- From: Bob Hanlon <hanlonr at cox.net>
- Date: Sat, 3 Mar 2007 00:50:04 -0500 (EST)
- Reply-to: hanlonr at cox.net
Sum[n,{n,m}]/.m->10^9
500000000500000000
Bob Hanlon
---- Raj <rajanikanth at gmail.com> wrote:
> hi!
>
> Could somebody tell me what would be the fastest way to add up a
> billion numbers(from 1 to 10^9 i.e the first billion numbers) in
> Mathematica?
>
> Ofcourse the answer is n(n+1)/2, but is there any other way in
> Mathematica other than the following one:
>
> Total@@Range[10^9]
>
> Thanks,
>
> Raj
>