t.roberts at cqu.edu.au
Sat Jan 31 05:00:09 CET 2009
Unfortunately, unless I'm doing something wrong, this appears to take 20 times as long... :-)
What on earth are numpy and psyco? Do I need to watch the Lord of the Rings?
> 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?
Have you tried an iterative approach?
step = 1
while step ** 13 < x:
step *= 2
root = 0
if (root + step) ** 13 <= x:
root += step
step //= 2
Probably not that fast in Python, though. numpy or psyco might help.
More information about the Python-list