p5MathPrimeUtil
utilities related to prime numbers, including fast sieves
WWW CVSWeb GITHub
Package versionp5MathPrimeUtil0.73p0

MaintainerThe OpenBSD ports mailinglist
A module for number theory in Perl. This includes prime sieving,
primality tests, primality proofs, integer factoring, counts /
bounds / approximations for primes, nth primes, and twin primes,
random prime generation, and much more.
This module is the fastest on CPAN for almost all operations it
supports. This includes Math::Prime::XS, Math::Prime::FastSieve,
Math::Factor::XS, Math::Prime::TiedArray, Math::Big::Factors,
Math::Factoring, and Math::Primality (when the GMP module is
available). For numbers in the 1020 digit range, it is often orders
of magnitude faster. Typically it is faster than Math::Pari for
64bit operations.
All operations support both Perl UV's (32bit or 64bit) and bignums.
If you want high performance with big numbers (larger than Perl's
native 32bit or 64bit size), you should install Math::Prime::Util::GMP
and Math::BigInt::GMP. This will be a recurring theme throughout
this documentation  while all bignum operations are supported in
pure Perl, most methods will be much slower than the C+GMP alternative.
The module is threadsafe and allows concurrency between Perl threads
while still sharing a prime cache. It is not itself multithreaded.
See the Limitations section if you are using Win32 and threads in
your program. Also note that Math::Pari is not threadsafe (and
will crash as soon as it is loaded in threads), so if you use
Math::BigInt::Pari rather than Math::BigInt::GMP or the default
backend, things will go pearshaped.
Two scripts are also included and installed by default:
* primes.pl displays primes between start and end values or
expressions, with many options for filtering (e.g.
twin, safe, circular, good, lucky, etc.). Use help
to see all the options.
* factor.pl operates similar to the GNU factor program.
It supports bigint and expression inputs.
 STEM>=0.50:math/p5MathPrimeUtilGMP