Re: [Tutor] how to handle big numbers

2011-12-10 Thread Peter Otten
lina wrote: > On Sat, Dec 10, 2011 at 6:09 PM, Peter Otten <__pete...@web.de> wrote: >> surya k wrote: >> >>> Finding factorial of 8 or 9 isn't big. If I would like to find factorial >>> of 32327, how can I ? >> >> gmpy is a library designed for working with large numbers. Compare: >> > import

Re: [Tutor] how to handle big numbers

2011-12-10 Thread lina
On Sat, Dec 10, 2011 at 6:09 PM, Peter Otten <__pete...@web.de> wrote: > surya k wrote: > >> Finding factorial of 8 or 9 isn't big. If I would like to find factorial >> of 32327, how can I ? > > gmpy is a library designed for working with large numbers. Compare: > import time def bench(f,

Re: [Tutor] how to handle big numbers

2011-12-10 Thread Peter Otten
surya k wrote: > Finding factorial of 8 or 9 isn't big. If I would like to find factorial > of 32327, how can I ? gmpy is a library designed for working with large numbers. Compare: >>> import time >>> def bench(f, *args): ... start = time.time() ... try: ... return f(*args)

Re: [Tutor] how to handle big numbers

2011-12-09 Thread Steven D'Aprano
surya k wrote: Finding factorial of 8 or 9 isn't big. If I would like to find factorial of 32327, how can I ?? py> import math py> n = math.factorial(32327) # takes about 2 seconds on my computer py> s = str(n) # takes about 30 seconds py> len(s) 131744 py> print s[:10] + "..."

Re: [Tutor] how to handle big numbers

2011-12-09 Thread Robert Sjoblom
> There are other approaches that may bear looking at, like the SciPy library. >  But first we'd need to know just what you need with this factorial. Wouldn't a prime swing implementation be the absolutely fastest? Something like this: http://en.literateprograms.org/Special:Downloadcode/Factorials

Re: [Tutor] how to handle big numbers

2011-12-09 Thread Dave Angel
On 12/09/2011 03:04 PM, surya k wrote: Date: Fri, 9 Dec 2011 14:53:07 -0500 From: d...@davea.name To: sur...@live.com CC: tutor@python.org Subject: Re: [Tutor] how to handle big numbers On 12/09/2011 02:25 PM, surya k wrote: Finding factorial of 8

Re: [Tutor] how to handle big numbers

2011-12-09 Thread surya k
> Date: Fri, 9 Dec 2011 14:53:07 -0500 > From: d...@davea.name > To: sur...@live.com > CC: tutor@python.org > Subject: Re: [Tutor] how to handle big numbers > > On 12/09/2011 02:25 PM, surya k wrote: > > Finding factorial of 8

Re: [Tutor] how to handle big numbers

2011-12-09 Thread Dave Angel
On 12/09/2011 02:25 PM, surya k wrote: Finding factorial of 8 or 9 isn't big. If I would like to find factorial of 32327, how can I ?? ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscriptio

Re: [Tutor] how to handle big numbers

2011-12-09 Thread Alan Gauld
On 09/12/11 19:25, surya k wrote: Finding factorial of 8 or 9 isn't big. If I would like to find factorial of 32327, how can I ?? Just type it in, but expect to wait a long time for the answer... Python integers are limited by the memory of your machi

[Tutor] how to handle big numbers

2011-12-09 Thread surya k
Finding factorial of 8 or 9 isn't big. If I would like to find factorial of 32327, how can I ?? ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mail