MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

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
> 



  • Prev by Date: Re: Means
  • Next by Date: Re: change filename automatically in Export Command
  • Previous by thread: Re: fastest way to add up a billion numbers
  • Next by thread: Re: fastest way to add up a billion numbers