Changes for version 0.58 - 2016-05-21
- API Changes
- prev_prime($n) where $n <= 2 now returns undef instead of 0. This may enable catching range errors, and is technically more correct.
- nth_prime(0) now returns undef instead of 0. This should help catch cases where the base wasn't understood. The change is similar for all the nth_* functions (e.g. nth_twin_prime).
- sumdigits(n,base) will interpret n as a number in the given base, rather than the Pari/GP method of converting decimal n to that base then summing. This allows sumdigits to easily sum hex strings. The old behavior is easily done with vecsum(todigits(n, base)).
- binary() was not intended to be released (todigits and todigitstring are supersets), but the documentation got left in. Remove docs.
- ADDED
- addmod(a, b, n) a + b mod n
- mulmod(a, b, n) a * b mod n
- divmod(a, b, n) a / b mod n
- powmod(a, b, n) a ^ b mod n
- sqrtmod(a, n) modular square root
- is_euler_pseudoprime(n,a[...]) Euler test to given bases
- is_primitive_root(r, n) is r a primitive root mod n
- is_quasi_carmichael(n) is n a Quasi-Carmichael number
- hclassno(n) Hurwitz class number H(n) * 12
- sieve_range(n, width, depth) sieve to given depth, return offsets
- FUNCTIONALITY AND PERFORMANCE
- Fixed incorrect table entries for 2^16th Ramanujan prime count and nth_ramanujan_prime(23744).
- foroddcomposites with certain arguments would start with 10 instead of 9.
- lucasu and lucasv should return bigint types.
- vecsum will handle 128-bit sums internally (performance increase).
- Speedup is_carmichael.
- Speedup znprimroot, 10% for small inputs, 10x for large composites.
- Speedup znlog ~2x. It is now Rho racing an interleaved BSGS.
- Change AKS to Bernstein 2003 theorem 4.1. 5-20x faster than Bornemann, 20000+x faster than V6.
- sum_primes now uses tables for native sizes (performance increase).
- ramanujan_tau uses Cohen's hclassno method instead of the sigma calculation. This is 3-4x faster than the GMP code for inputs > 300k, and much faster than the older PP code.
- fromdigits much faster for large base-10 arrays. Timing is better than split plus join when output is a bigint.
Modules
Utilities related to prime numbers, including fast sieves and factoring
Elliptic curve operations for affine points
Elliptic curve operations for projective points
An auto-free object for Math::Prime::Util
Pure Perl version of Math::Prime::Util
PP front end for Math::Prime::Util
Primality proofs and certificates
A tied array for primes
An object iterator for primes
Generate random primes
Perl Big Float versions of Riemann Zeta and R functions
Number theory utilities
Examples
- examples/README
- examples/abundant.pl
- examples/csrand-gmp.pl
- examples/csrand.pl
- examples/fibprime-mce.pl
- examples/fibprime-serial.pl
- examples/fibprime-threads.pl
- examples/find_mr_bases.pl
- examples/inverse_totient.pl
- examples/ktuplet-threads.pl
- examples/ktuplet.pl
- examples/numseqs.pl
- examples/porter.pl
- examples/project_euler_010.pl
- examples/project_euler_021.pl
- examples/project_euler_037.pl
- examples/project_euler_047.pl
- examples/project_euler_049.pl
- examples/project_euler_069.pl
- examples/project_euler_070.pl
- examples/project_euler_072.pl
- examples/project_euler_095.pl
- examples/project_euler_131.pl
- examples/project_euler_142.pl
- examples/project_euler_193.pl
- examples/project_euler_211.pl
- examples/project_euler_214.pl
- examples/project_euler_342.pl
- examples/project_euler_357.pl
- examples/sophie_germain.pl
- examples/twin_primes.pl
- examples/verify-cert.pl
- examples/verify-gmp-ecpp-cert.pl
- examples/verify-primegaps.pl
- examples/verify-sage-ecpp-cert.pl