Sun Feb 1 07:17:07 CET 2009
"Tim Roberts" <t.roberts at cqu.edu.au> writes:
> for root in powersp:
> nroot = round(bignum**(1.0/root))
> if bignum==long(nroot)**root:
> which is probably very inefficient, but I can't see anything better.....
Actually that will not be accurate enough to know if bignum is, say, a perfect square.
You will have to do the small-power tests at full precision (or use a fancy algorithm).
Larger powers can be done with floats.
More information about the Python-list