Safe prime numbers in Python

Tim Churches tchur at
Wed Jan 14 22:53:13 CET 2004

On Thu, 2004-01-15 at 03:35, Skip Montanaro wrote:
>     >> Here's what I came up with using gmpy:
>     ...
>     Scott> I suspect it might be faster if you looked for the lower prime:

Many thanks to Skip Montanaro and Scott Daniels for these suggestions. I
did not suspect that the gmpy library would have functions for prime
finding or testing. With a few days of processing I'll have more safe
primes than I'll ever need. Next step is to find all quadratic residuals
modulo p (where p is a safe prime). It notice that GMP has a function to
calculate the Legendre symbol (which hopefully gmpy wraps), so it should
be simple. Fab!


Tim C

PGP/GnuPG Key 1024D/EAF993D0 available from keyservers everywhere
or at
Key fingerprint = 8C22 BF76 33BA B3B5 1D5B  EB37 7891 46A9 EAF9 93D0

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 196 bytes
Desc: This is a digitally signed message part
URL: <>

More information about the Python-list mailing list