nth root

Tim Roberts t.roberts at cqu.edu.au
Sat Jan 31 00:43:37 EST 2009


Dan,
 
Thanks - you're probably right - just my intuition said to me that rather than calculating that the 13th root of 4021503534212915433093809093996098953996019232
is 3221.2904208350265....
there must be a quicker way of finding out its between 3221 and 3222....
 
....but perhaps not.
 
Tim

________________________________

From: Dan Goodman [mailto:dg.gmane at thesamovar.net]
Sent: Sat 31-Jan-09 3:11 PM
To: python-list at python.org
Subject: Re: nth root



Takes less than 1 sec here to do (10**100)**(1./13) a million times, and
only about half as long to do (1e100)**(1./13), or about 14 times as
long as to do .2**2. Doesn't look like one could hope for it to be that
much quicker as you need 9 sig figs of accuracy to get the integer part
of (10**100)**(1./13) (floats have about 7 and doubles about 16).

Dan

Tim wrote:
> In PythonWin I'm running a program to find the 13th root (say) of
> millions of hundred-digit numbers.  I'm using
>     n = 13
>     root = base**(1.0/n)
> which correctly computes the root to a large number of decimal
> places, but therefore takes a long time.  All I need is the integer
> component.  Is there a quicker way?
> 
>
>
> ------------------------------------------------------------------------
>
> --
> http://mail.python.org/mailman/listinfo/python-list

--
http://mail.python.org/mailman/listinfo/python-list





More information about the Python-list mailing list