integer square roots

Paul Rubin http
Thu Jul 23 22:48:12 EDT 2009


casevh <casevh at gmail.com> writes:
> gmpy.is_square() is quite fast. On a older 32-bit Linux box, it can
> test approximately 400,000 100-digits numbers per second. The time
> includes conversion from a string. If the numbers are already Python
> longs, it can check 800,000 per second. Checking a billion is not
> unreasonable.

Wow, that is pretty impressive.  A look at the code shows it uses
quite a few optimizations:

http://sage.math.washington.edu/home/novoselt/gmp-4.2.4/mpn/perfsqr.c



More information about the Python-list mailing list