head 1.21; access; symbols pkgsrc-2023Q4:1.21.0.18 pkgsrc-2023Q4-base:1.21 pkgsrc-2023Q3:1.21.0.16 pkgsrc-2023Q3-base:1.21 pkgsrc-2023Q2:1.21.0.14 pkgsrc-2023Q2-base:1.21 pkgsrc-2023Q1:1.21.0.12 pkgsrc-2023Q1-base:1.21 pkgsrc-2022Q4:1.21.0.10 pkgsrc-2022Q4-base:1.21 pkgsrc-2022Q3:1.21.0.8 pkgsrc-2022Q3-base:1.21 pkgsrc-2022Q2:1.21.0.6 pkgsrc-2022Q2-base:1.21 pkgsrc-2022Q1:1.21.0.4 pkgsrc-2022Q1-base:1.21 pkgsrc-2021Q4:1.21.0.2 pkgsrc-2021Q4-base:1.21 pkgsrc-2021Q3:1.19.0.22 pkgsrc-2021Q3-base:1.19 pkgsrc-2021Q2:1.19.0.20 pkgsrc-2021Q2-base:1.19 pkgsrc-2021Q1:1.19.0.18 pkgsrc-2021Q1-base:1.19 pkgsrc-2020Q4:1.19.0.16 pkgsrc-2020Q4-base:1.19 pkgsrc-2020Q3:1.19.0.14 pkgsrc-2020Q3-base:1.19 pkgsrc-2020Q2:1.19.0.12 pkgsrc-2020Q2-base:1.19 pkgsrc-2020Q1:1.19.0.8 pkgsrc-2020Q1-base:1.19 pkgsrc-2019Q4:1.19.0.10 pkgsrc-2019Q4-base:1.19 pkgsrc-2019Q3:1.19.0.6 pkgsrc-2019Q3-base:1.19 pkgsrc-2019Q2:1.19.0.4 pkgsrc-2019Q2-base:1.19 pkgsrc-2019Q1:1.19.0.2 pkgsrc-2019Q1-base:1.19 pkgsrc-2018Q4:1.18.0.4 pkgsrc-2018Q4-base:1.18 pkgsrc-2018Q3:1.18.0.2 pkgsrc-2018Q3-base:1.18 pkgsrc-2018Q2:1.17.0.6 pkgsrc-2018Q2-base:1.17 pkgsrc-2018Q1:1.17.0.4 pkgsrc-2018Q1-base:1.17 pkgsrc-2017Q4:1.17.0.2 pkgsrc-2017Q4-base:1.17 pkgsrc-2017Q3:1.13.0.4 pkgsrc-2017Q3-base:1.13 pkgsrc-2017Q2:1.12.0.2 pkgsrc-2017Q2-base:1.12 pkgsrc-2017Q1:1.11.0.4 pkgsrc-2017Q1-base:1.11 pkgsrc-2016Q4:1.11.0.2 pkgsrc-2016Q4-base:1.11 pkgsrc-2016Q3:1.10.0.2 pkgsrc-2016Q3-base:1.10 pkgsrc-2016Q2:1.8.0.4 pkgsrc-2016Q2-base:1.8 pkgsrc-2016Q1:1.8.0.2 pkgsrc-2016Q1-base:1.8 pkgsrc-2015Q4:1.7.0.2 pkgsrc-2015Q4-base:1.7 pkgsrc-2015Q3:1.6.0.10 pkgsrc-2015Q3-base:1.6 pkgsrc-2015Q2:1.6.0.8 pkgsrc-2015Q2-base:1.6 pkgsrc-2015Q1:1.6.0.6 pkgsrc-2015Q1-base:1.6 pkgsrc-2014Q4:1.6.0.4 pkgsrc-2014Q4-base:1.6 pkgsrc-2014Q3:1.6.0.2 pkgsrc-2014Q3-base:1.6 pkgsrc-2014Q2:1.5.0.8 pkgsrc-2014Q2-base:1.5 pkgsrc-2014Q1:1.5.0.6 pkgsrc-2014Q1-base:1.5 pkgsrc-2013Q4:1.5.0.4 pkgsrc-2013Q4-base:1.5 pkgsrc-2013Q3:1.5.0.2 pkgsrc-2013Q3-base:1.5 pkgsrc-2013Q2:1.3.0.6 pkgsrc-2013Q2-base:1.3 pkgsrc-2013Q1:1.3.0.4 pkgsrc-2013Q1-base:1.3 pkgsrc-2012Q4:1.3.0.2 pkgsrc-2012Q4-base:1.3; locks; strict; comment @# @; 1.21 date 2021.10.26.10.55.54; author nia; state Exp; branches; next 1.20; commitid vzl6zVlmjiF3hjeD; 1.20 date 2021.10.07.14.28.16; author nia; state Exp; branches; next 1.19; commitid wLkpKfebF6VS3TbD; 1.19 date 2019.01.12.12.50.10; author wen; state Exp; branches; next 1.18; commitid 5V0s1leGqBddDu7B; 1.18 date 2018.09.02.07.29.32; author wiz; state Exp; branches; next 1.17; commitid YfRkXVGoApE96vQA; 1.17 date 2017.12.03.08.41.29; author wiz; state Exp; branches; next 1.16; commitid RIYv96H3yxw3hqhA; 1.16 date 2017.11.13.15.22.31; author wiz; state Exp; branches; next 1.15; commitid moejkFOlkYTz8TeA; 1.15 date 2017.10.23.13.01.48; author wiz; state Exp; branches; next 1.14; commitid SOLcvXHlKg162bcA; 1.14 date 2017.09.26.14.37.13; author wiz; state Exp; branches; next 1.13; commitid dMuimIsNrThFqI8A; 1.13 date 2017.09.17.20.10.59; author wiz; state Exp; branches; next 1.12; commitid a7VaLEGkMN85zA7A; 1.12 date 2017.05.13.01.29.02; author wen; state Exp; branches; next 1.11; commitid LL5mdCLublS3raRz; 1.11 date 2016.11.28.12.36.05; author wen; state Exp; branches; next 1.10; commitid kRviGMVtVbJVsTvz; 1.10 date 2016.08.09.00.14.33; author wen; state Exp; branches; next 1.9; commitid BtumqfkFyxfJVyhz; 1.9 date 2016.07.26.06.50.24; author wen; state Exp; branches; next 1.8; commitid YPQS6HMvGQcszNfz; 1.8 date 2016.02.14.11.44.19; author wen; state Exp; branches; next 1.7; commitid cuYhNxhCFqK2rSUy; 1.7 date 2015.11.03.23.33.39; author agc; state Exp; branches; next 1.6; commitid vBzTXDWz0lsAFHHy; 1.6 date 2014.09.04.07.09.56; author wen; state Exp; branches; next 1.5; commitid ntl4kdgvd2lbTZOx; 1.5 date 2013.08.25.01.28.38; author wen; state Exp; branches; next 1.4; commitid Aba9TGK3Ndnk3M2x; 1.4 date 2013.07.14.06.11.50; author wen; state Exp; branches; next 1.3; commitid ilNAt4vzmMX8YoXw; 1.3 date 2012.12.10.13.35.45; author wen; state Exp; branches; next 1.2; 1.2 date 2012.11.30.08.24.50; author wen; state Exp; branches; next 1.1; 1.1 date 2012.10.19.07.30.32; author sno; state Exp; branches; next ; desc @@ 1.21 log @math: Replace RMD160 checksums with BLAKE2s checksums All checksums have been double-checked against existing RMD160 and SHA512 hashes @ text @$NetBSD: distinfo,v 1.20 2021/10/07 14:28:16 nia Exp $ BLAKE2s (Math-Prime-Util-0.73.tar.gz) = d2e77429c38f90cd0502569fd4635f628648ff8b7460fb0746af0715bceb43e3 SHA512 (Math-Prime-Util-0.73.tar.gz) = a772ba116b51c906e1f6d25d8bc1cbda93c01220998f9606aabc767fe8d0973b71a86f027b3a2a6cc75de026813a70ea825532f2070ecfadbe697834a025404e Size (Math-Prime-Util-0.73.tar.gz) = 617032 bytes @ 1.20 log @math: Remove SHA1 hashes for distfiles @ text @d1 1 a1 1 $NetBSD: distinfo,v 1.19 2019/01/12 12:50:10 wen Exp $ d3 1 a3 1 RMD160 (Math-Prime-Util-0.73.tar.gz) = acd1e11eb7df7568eae227c5e7172c95755694eb @ 1.19 log @Update to 0.73 Upstream changes: 0.73 2018-11-15 [ADDED] - inverse_totient(n) the image of euler_phi(n) [FIXES] - Try to work around 32-bit platforms in semiprime approximations. Cannot reproduce on any of my 32-bit test platforms. - Fix RT 127605, memory use in for... iterators. 0.72 2018-11-08 [ADDED] - nth_semiprime(n) the nth semiprime - nth_semiprime_approx(n) fast approximate nth semiprime - semiprime_count_approx(n) fast approximate semiprime count - semi_primes as primes but for semiprimes - forsetproduct {...} \@@a,\@@b,... Cartesian product of list refs [FIXES] - Some platforms are extremely slow for is_pillai. Speed up tests. - Ensure random_factored_integer factor list is sorted min->max. - forcomposites didn't check lastfor on every callback. - Sun's compilers, in a valid interpretation of the code, generated divide by zero code for pillai testing. [FUNCTIONALITY AND PERFORMANCE] - chebyshev_theta and chebyshev_psi redone and uses a table. Large inputs are significantly faster. - Convert some FP functions to use quadmath if possible. Without quadmath there should be no change. With quadmath functions like LogarithmicIntegral and LambertW will be slower but more accurate. - semiprime_count for non-trivial inputs uses a segmented sieve and precalculates primes for larger values so can run 2-3x faster. - forsemiprimes uses a sieve so large ranges are much faster. - ranged moebius more efficient for small intervals. - Thanks to GRAY for his module Set::Product which has clean and clever XS code, which I used to improve my code. - forfactored uses multicall. Up to 2x faster. - forperm, forcomb, forderange uses multicall. 2-3x faster. - Frobenius-Khashin algorithm changed from 2013 version to 2016/2018. @ text @d1 1 a1 1 $NetBSD: distinfo,v 1.18 2018/09/02 07:29:32 wiz Exp $ a2 1 SHA1 (Math-Prime-Util-0.73.tar.gz) = d7a74202d9f449f762470f82630db8cac9ba7420 @ 1.18 log @p5-Math-Prime-Util: update to 0.71. 0.71 2018-08-28 [ADDED] - forfactored { ... } a,b loop n=a..b setting $_=n, @@_=factor(n) - forsquarefree { ... } a,b as forfactored, but only square-free n - forsemiprimes { ... } a,b as forcomposites, but only semiprimes - random_factored_integer(n) random [1..n] w/ array ref of factors - semiprime_count([lo],hi) counts semiprimes in range [FIXES] - Monolithic sieves beyond 30*2^32 (~ 1.2 * 10^11) overflowed. - is_semiprime was wrong for five small values since 0.69. Fixed. [FUNCTIONALITY AND PERFORMANCE] - is_primitive_root much faster (doesn't need to calulate totient, and faster rejection when n has no primitive root). - znprimroot and znorder use Montgomery, 1.2x to 2x faster. - slightly faster sieve_range for native size inputs (use factor_one). - bin/primes.pl faster for palindromic primes and works for 10^17 [OTHER] - Added ability to use -DBENCH_SEG for benchmarking sieves using prime_count and ntheory::_segment_pi without table optimizations. - Reorg of main factor loop. Should be identical from external view. - Internal change to is_semiprime and is_catalan_pseudoprime. @ text @d1 1 a1 1 $NetBSD: distinfo,v 1.17 2017/12/03 08:41:29 wiz Exp $ d3 4 a6 4 SHA1 (Math-Prime-Util-0.71.tar.gz) = 272fc5cdd4065b8b845ba176c37f8441747bd6c9 RMD160 (Math-Prime-Util-0.71.tar.gz) = daf4ed5b4b7ab274cd01d91de507f6d3743499ab SHA512 (Math-Prime-Util-0.71.tar.gz) = a7ad135227672af78917e6d4adf782eef1d092801436d13268f21fa838529a7e3ef99bcdc177c490d954d56c96a99cb3ab803a5e3a824b29dc1024d0289bf6c8 Size (Math-Prime-Util-0.71.tar.gz) = 599678 bytes @ 1.17 log @p5-Math-Prime-Util: update to 0.70. 0.70 2017-12-02 [FIXES] - prime_count(a,b) incorrect for a={3..7} and b < 66000000. First appeared in v0.65 (May 2017). Reported by Trizen. Fixed. - Also impacted were nth_ramanujan_prime and _lower/_upper for small input values. [FUNCTIONALITY AND PERFORMANCE] - Some utility functions used prime counts. Unlink for more isolation. - prime_count_approx uses full precision for bigint or string input. - LogarithmicIntegral and ExponentialIntegral will try to use our GMP backend if possible. - Work around old Math::BigInt::FastCalc (as_int() doesn't work right). - prime_memfree also calls GMP's memfree function. This will clear the cached constants (e.g. Pi, Euler). - Calling srand or csrand will also result in the GMP backend CSPRNG functions being called. This gives more consistent behavior. [OTHER] - Turned off threads testing unless release or extended testing is used. A few smokers seem to have threads lib that die before we event start. - Removed all Math::MPFR code and references. The latest GMP backend has everything we need. - The MPU_NO_XS and MPU_NO_GMP environment variables are documented. @ text @d1 1 a1 1 $NetBSD: distinfo,v 1.16 2017/11/13 15:22:31 wiz Exp $ d3 4 a6 4 SHA1 (Math-Prime-Util-0.70.tar.gz) = 1847d4a7ebe3c98df39b0d1beee47b8b4b6e65aa RMD160 (Math-Prime-Util-0.70.tar.gz) = af70efa674e9481b7a277c1e2c0b1949ed29be37 SHA512 (Math-Prime-Util-0.70.tar.gz) = c05964c8a3f76bb7881cbcafa0d31b76ac34ff3aa931e834ee151ae79f5f582b5681b31ad75f51d63d3129b9c11246a458b196635ca7c242dbd6dedaddb64298 Size (Math-Prime-Util-0.70.tar.gz) = 593408 bytes @ 1.16 log @p5-Math-Prime-Util: update to 0.69. 0.69 2017-11-08 [ADDED] - is_totient(n) true if euler_phi(x) == n for some x [FUNCTIONALITY AND PERFORMANCE] - is_square_free uses abs(n), like Pari and moebius. - is_primitive_root could be wrong with even n on some platforms. - euler_phi and moebius with negative range inputs weren't consistent. - factorialmod given a large n and m where m was a composite with large square factors was incorrect. Fixed. - numtoperm will accept negative k values (k is always mod n!) - Split XS mapping of many primality tests. Makes more sense and improves performance for some calls. - Split final test in PP cluster sieve. - Support some new Math::Prime::Util::GMP functions from 0.47. - C spigot Pi is 30-60% faster on x86_64 by using 32-bit types. - Reworked some factoring code. - Remove ISAAC (Perl and C) since we use ChaCha. - Each thread allocs a new const array again instead of sharing. @ text @d1 1 a1 1 $NetBSD: distinfo,v 1.15 2017/10/23 13:01:48 wiz Exp $ d3 4 a6 4 SHA1 (Math-Prime-Util-0.69.tar.gz) = 61bcc8f871fd43154cc09a8a853d2516e877fb0f RMD160 (Math-Prime-Util-0.69.tar.gz) = 3150689afb090de221699c502fb3d445d8398e33 SHA512 (Math-Prime-Util-0.69.tar.gz) = 07780f28398b6e2cfbc1ccaa2cce2d3b32ea000ec9fc3909d9650c0c9dc6f24c0982de8ce52bc3dcfc525e10ad2d5a687a1833a6fab82008345fdba78fbfdfeb Size (Math-Prime-Util-0.69.tar.gz) = 593915 bytes @ 1.15 log @p5-Math-Prime-Util: update to 0.68. 0.68 2017-10-19 [API Changes] - forcomb with one argument iterates over the power set, so k=0..n instead of k=n. The previous behavior was undocumented. The new behavior matches Pari/GP (forsubset) and Perl6 (combinations). [ADDED] - factorialmod(n,m) n! mod m calculated efficiently - is_fundamental(d) true if d a fundamental discriminant [FUNCTIONALITY AND PERFORMANCE] - Unknown bigint classes no longer return two values after objectify. Thanks to Daniel Șuteu for finding this. - Using lastfor inside a formultiperm works correctly now. - randperm a little faster for k < n cases, and can handle big n values without running out of memory as long as k << n. E.g. 5000 random native ints without dups: @@r = randperm(~0,5000); - forpart with primes pulls min/max values in for a small speedup. - forderange 10-20% faster. - hammingweight for bigints 3-8x faster. - Add Math::GMPq and Math::AnyNum as possible bigint classes. Inputs of these types will be relied on to stringify correctly, and if this results in an integer string, to intify correctly. This should give a large speedup for these types. - Factoring native integers is 1.2x - 2x faster. This is due to a number of changes. - Add Lehman factoring core. Since this is not exported or used by default, the API for factor_lehman may change. - All new Montgomery math. Uses mulredc asm from Ben Buhrow. Faster and smaller. Most primality and factoring code 10% faster. - Speedup for factoring by running more Pollard-Rho-Brent, revising SQUFOF, updating HOLF, updating recipe. @ text @d1 1 a1 1 $NetBSD: distinfo,v 1.14 2017/09/26 14:37:13 wiz Exp $ d3 4 a6 4 SHA1 (Math-Prime-Util-0.68.tar.gz) = 27c8efbdaaa7b89dea87fe31deab3be36f02b8cf RMD160 (Math-Prime-Util-0.68.tar.gz) = b7d844fdbd1cac14ce23946ff6a2f3731f60a83b SHA512 (Math-Prime-Util-0.68.tar.gz) = 6373537d10939ffa4c2542e64da575b1da73652dda26df6108e703faf148c0edec5add016d5c53cbdcd1947fe62d9bdeee752ee9699348f7092056c5c322a238 Size (Math-Prime-Util-0.68.tar.gz) = 593993 bytes @ 1.14 log @p5-Math-Prime-Util: update to 0.67. 0.67 2017-09-23 [ADDED] - lastfor stops forprimes (etc.) iterations - is_square(n) returns 1 if n is a perfect square - is_polygonal(n,k) returns 1 if n is a k-gonal number [FUNCTIONALITY AND PERFORMANCE] - shuffle prototype is @@ instead of ;@@, so matches List::Util. - On Perl 5.8 and earlier we will call PP instead of trying direct-to-GMP. Works around a bug in XS trying to turn the result into an object where 5.8.7 and earlier gets lost. - We create more const integers, which speeds up common uses of permutations. - CSPRNG now stores context per-thread rather than using a single mutex-protected context. This speeds up anything using random numbers a fair amount, especially with threaded Perls. - With the above two optimizations, randperm(144) is 2.5x faster. - threading test has threaded srand/irand test added back in, showing context is per-thread. Each thread gets its own sequence and calls to srand/csrand and using randomness doesn't impact other threads. @ text @d1 1 a1 1 $NetBSD: distinfo,v 1.13 2017/09/17 20:10:59 wiz Exp $ d3 4 a6 4 SHA1 (Math-Prime-Util-0.67.tar.gz) = 7f58a95832ff78e463d2856327fbc6cd29fef6fd RMD160 (Math-Prime-Util-0.67.tar.gz) = 8f9ea466dd1effe4e9564461cc27fac0e1d46025 SHA512 (Math-Prime-Util-0.67.tar.gz) = 0be38e6edb2d878103e0570eeb40430527b9389676d7e861889f42b235668be67c19019fe6c756087100110fb8c40c87b0440ea5d04079c8d14db38448c9e39d Size (Math-Prime-Util-0.67.tar.gz) = 588847 bytes @ 1.13 log @p5-Math-Prime-Util: update to 0.66. 0.66 2017-09-12 [ADDED] - random_semiprime random n-bit semiprime (even split) - random_unrestricted_semiprime random n-bit semiprime - forderange { ... } n derangements iterator - numtoperm(n,k) returns kth permutation of n elems - permtonum([...]) returns rank of permutation array ref - randperm(n[,k]) random permutation of n elements - shuffle(...) random permutation of an array [FUNCTIONALITY AND PERFORMANCE] - Rewrite sieve marking based on Kim Walisch's new simple mod-30 sieve. Similar in many ways to my old code, but this is simpler and faster. - is_pseudoprime, is_euler_pseudoprime, is_strong_pseudoprime changed to better handle the unusual case of base >= n. - Speedup for is_carmichael. - is_frobenius_underwood_pseudoprime checks for jacobi == 0. Faster. - Updated Montgomery inverse from Robert Gerbicz. - Tighter nth prime bounds for large inputs from Axler 2017-06. Redo Ramanujan bounds since they're based on nth prime bounds. - chinese objectifies result (i.e. big results are bigints). - Internal support for Baillie-Wagstaff (pg 1402) extra Lucas tests. - More standardized Lucas parameter selection. Like other tests and the 1980 paper, checks jacobi(D) in the loop, not gcd(D). - entropy_bytes, srand, and csrand moved to XS. - Add -secure import to disallow all manual seeding. @ text @d1 1 a1 1 $NetBSD: distinfo,v 1.12 2017/05/13 01:29:02 wen Exp $ d3 4 a6 4 SHA1 (Math-Prime-Util-0.66.tar.gz) = c5809df6395a896babe04c63ebf54372209b6752 RMD160 (Math-Prime-Util-0.66.tar.gz) = 6c4fe084c6e005ddfff98250680e42335ad88d72 SHA512 (Math-Prime-Util-0.66.tar.gz) = dafe91993cd48309a8bc7b675e9b37f7cb119295da31c404a4405d5dc3faa507c689e014db769f8d0552dffecd317df4a83118a017f62222f3c3215947692eae Size (Math-Prime-Util-0.66.tar.gz) = 583938 bytes @ 1.12 log @Update to 0.65 Upstream changes: 0.65 2017-05-03 [API Changes] - Config options irand and primeinc are deprecated. They will carp if set. [FUNCTIONALITY AND PERFORMANCE] - Add Math::BigInt::Lite to list of known bigint objects. - sum_primes fix for certain ranges with results near 2^64. - is_prime, next_prime, prev_prime do a lock-free check for a find-in-cache optimization. This is a big help on on some platforms with many threads. - C versions of LogarithmicIntegral and inverse_li rewritten. inverse_li honors the documentation promise within FP representation. Thanks to Kim Walisch for motivation and discussion. - Slightly faster XS nth_prime_approx. - PP nth_prime_approx uses inverse_li past 1e12, which should run at a reasonable speed now. - Adjusted crossover points for segment vs. LMO interval prime_count. - Slightly tighter prime_count_lower, nth_prime_upper, and Ramanujan bounds. 0.64 2017-04-17 [FUNCTIONALITY AND PERFORMANCE] - inverse_li switched to Halley instead of binary search. Faster. - Don't call pre-0.46 GMP backend directly for miller_rabin_random. 0.63 2017-04-16 [FUNCTIONALITY AND PERFORMANCE] - Moved miller_rabin_random to separate interface. Make catching of negative bases more explicit. 0.62 2017-04-16 [API Changes] - The 'irand' config option is removed, as we now use our own CSPRNG. It can be seeded with csrand() or srand(). The latter is not exported. - The 'primeinc' config option is deprecated and will go away soon. [ADDED] - irand() Returns uniform random 32-bit integer - irand64() Returns uniform random 64-bit integer - drand([fmax]) Returns uniform random NV (floating point) - urandomb(n) Returns uniform random integer less than 2^n - urandomm(n) Returns uniform random integer in [0, n-1] - random_bytes(nbytes) Return a string of CSPRNG bytes - csrand(data) Seed the CSPRNG - srand([UV]) Insecure seed for the CSPRNG (not exported) - entropy_bytes(nbytes) Returns data from our entropy source - :rand Exports srand, rand, irand, irand64 - nth_ramanujan_prime_upper(n) Upper limit of nth Ramanujan prime - nth_ramanujan_prime_lower(n) Lower limit of nth Ramanujan prime - nth_ramanujan_prime_approx(n) Approximate nth Ramanujan prime - ramanujan_prime_count_upper(n) Upper limit of Ramanujan prime count - ramanujan_prime_count_lower(n) Lower limit of Ramanujan prime count - ramanujan_prime_count_approx(n) Approximate Ramanujan prime count [FUNCTIONALITY AND PERFORMANCE] - vecsum is faster when returning a bigint from native inputs (we construct the 128-bit string in C, then call _to_bigint). - Add a simple Legendre prime sum using uint128_t, which means only for modern 64-bit compilers. It allows reasonably fast prime sums for larger inputs, e.g. 10^12 in 10 seconds. Kim Walisch's primesum is much more sophisticated and over 100x faster. - is_pillai about 10x faster for composites. - Much faster Ramanujan prime count and nth prime. These also now use vastly less memory even with large inputs. - small speed ups for cluster sieve. - faster PP is_semiprime. - Add prime option to forpart restrictions for all prime / non-prime. - is_primitive_root needs two args, as documented. - We do random seeding ourselves now, so remove dependency. - Random primes functions moved to XS / GMP, 3-10x faster. 0.61 2017-03-12 [ADDED] - is_semiprime(n) Returns 1 if n has exactly 2 prime factors - is_pillai(p) Returns 0 or v wherev v! % n == n-1 and n % v != 1 - inverse_li(n) Integer inverse of Logarithmic Integral [FUNCTIONALITY AND PERFORMANCE] - is_power(-1,k) now returns true for odd k. - RiemannZeta with GMP was not subtracting 1 from results > 9. - PP Bernoulli algorithm changed to Seidel from Brent-Harvey. 2x speedup. Math::BigNum is 10x faster, and our GMP code is 2000x faster. - LambertW changes in C and PP. Much better initial approximation, and switch iteration from Halley to Fritsch. 2 to 10x faster. - Try to use GMP LambertW for bignums if it is available. - Use Montgomery math in more places: = sqrtmod. 1.2-1.7x faster. = is_primitive_root. Up to 2x faster for some inputs. = p-1 factoring stage 1. - Tune AKS r/s selection above 32-bit. - primes.pl uses twin_primes function for ~3x speedup. - native chinese can handle some cases that used to overflow. Use Shell sort on moduli to prevent pathological-but-reasonable test case. - chinese directly to GMP - Switch to Bytes::Random::Secure::Tiny -- fewer dependencies. - PP nth_prime_approx has better MSE and uses inverse_li above 10^12. - All random prime functions will use GMP versions if possible and if a custom irand has not been configured. They are much faster than the PP versions at smaller bit sizes. - is_carmichael and is_pillai small speedups. @ text @d1 1 a1 1 $NetBSD: distinfo,v 1.11 2016/11/28 12:36:05 wen Exp $ d3 4 a6 4 SHA1 (Math-Prime-Util-0.65.tar.gz) = 1b3acd8d45dbe1a82b7137bc17f8fecb7dced847 RMD160 (Math-Prime-Util-0.65.tar.gz) = a273945fdd85c84f4dc55a36a8d0c11679a5b33c SHA512 (Math-Prime-Util-0.65.tar.gz) = 7d6db326291f3b09491ecb9e4280dc2cc97d65cec9fbcb70f1e521111170e51c0d2a57f0723d2866a8c492779fc57d01b3a2a7f7d38fa5d106422e4500c5de20 Size (Math-Prime-Util-0.65.tar.gz) = 575615 bytes @ 1.11 log @Update to 0.60 Upstream changes: 0.60 2016-10-09 [ADDED] - vecfirstidx { expr } @@n returns first index with expr true [FUNCTIONALITY AND PERFORMANCE] - Expanded and modified prime count sparse tables. Prime counts from 30k to 90M are 1.2x to 2.5x faster. It has no appreciable effect on the speed of prime counts larger than this size. - fromdigits works with bigint first arg, no need to stringify. Slightly faster for bigints, but slower than desired. - Various speedups and changes for fromdigits, todigits, todigitstring. - vecprod in PP for negative high-bit would return double not bigint. - Lah numbers added as Stirling numbers of the third kind. They've been in the GMP code for almost 2 years now. Also for big results, directly call the GMP code and objectify the result. - Small performance change to AKS (r,s) selection tuning. - On x86_64, use Montgomery math for Pollard/Brent Rho. This speeds up factoring significantly for large native inputs (e.g. 10-20 digits). - Use new GMP zeta and riemannr functions if possible, making some of our operations much faster without Math::MPFR. - print_primes with large args will try GMP sieve for big speedup. E.g. use bigint; print_primes(2e19,2e19+1e7); goes from 37 minutes to 7 seconds. This also removes a mistaken blank line at the end for certain ranges. - PP primes tries to use GMP. Only for calls from other PP code. - Slightly more accuracy in native ExponentialIntegral. - Slightly more accuracy in twin_prime_count_approx. - nth_twin_prime_approx was incorrect over 1e10 and over 2e16 would infinite loop due to Perl double conversion. - nth_twin_prime_approx a little faster and more accurate. @ text @d1 1 a1 1 $NetBSD: distinfo,v 1.10 2016/08/09 00:14:33 wen Exp $ d3 4 a6 4 SHA1 (Math-Prime-Util-0.60.tar.gz) = 8567f0193d4ffc96df28e66af435fdfe6f0ab7c5 RMD160 (Math-Prime-Util-0.60.tar.gz) = ddbf0b8cac76cb919dc83fb05f8c8c270f2fedc0 SHA512 (Math-Prime-Util-0.60.tar.gz) = 390121193b045fac5cb14225a785e06969e7851d86ab253cfab5cd77b50b172a5cde7747243830e5f513912a1b3519116716b668844d112af7237e7ab2c230c9 Size (Math-Prime-Util-0.60.tar.gz) = 535032 bytes @ 1.10 log @Update to 0.59 Upstream changes: 0.59 2016-08-03 [ADDED] - is_prime_power Returns k if n=p^k for p a prime. - logint(n,b) Integer logarithm. Largest e s.t. b^e <= n. - rootint(n,k) Integer k-th root. - ramanujan_sum(k,n) Ramanujan's sum [FUNCTIONALITY AND PERFORMANCE] - Fixes for quadmath: + Fix "infinity" in t/11-primes.t. + Fix native Pi to use quads. + Trim some threading tests. - Fix fromdigits memory error with large string. - Remove 3 threading tests that were causing issues with Perl -DDEBUGGING. - foroddcomposites with some odd start values could index incorrectly. - is_primitive_root(1,0) returns 0 instead of fp exception. - mertens() uses a little less memory. - 2x speedup for znlog with bigint values. - is_pseudoprime() and is_euler_pseudoprime() use Montgomery math so are much faster. They seem to be ~5% faster than Miller-Rabin now. - is_catalan_pseudoprime 1.1x to 1.4x faster. - is_perrin_pseudoprime over 10x faster. Uses Adams/Shanks doubling and Montgomery math. Single core, odd composites: ~8M range/s. - Add restricted Perrin pseudoprimes using an optional argument. - Add bloom filters to reject non-perfect cubes, fifths, and sevenths. is_power about 2-3x faster for native inputs. - forcomposites / foroddcomposites about 1.2x faster past 64-bit. - exp_mangoldt rewritten to use is_prime_power. - Integer root code rewritten and now exported. - We've been hacking around the problem of older Perls autovivifying functions at compile time. This makes functions that don't exist return true when asked if they're defined, which causes us distress. Store the available GMP functions before loading the PP code. XS code knows MPU::GMP version and calls as appropriate. This works around the auto-vivication, and lets us choose to call the GMP function based on version instead of just existence. E.g. GMP's is_power was added in 0.19, but didn't support negative powers until 0.28. @ text @d1 1 a1 1 $NetBSD: distinfo,v 1.9 2016/07/26 06:50:24 wen Exp $ d3 4 a6 4 SHA1 (Math-Prime-Util-0.59.tar.gz) = e3293c13f197930a853d1f26f25972b4cf59eb01 RMD160 (Math-Prime-Util-0.59.tar.gz) = 1f6c570d0c7b252274b953f506997aaa67203e69 SHA512 (Math-Prime-Util-0.59.tar.gz) = 63dcf9658404c322b86b340db9aca237cab22954e44adfe1992c93c768d35dc191159ae268c27db8cd15242e2c54fd0e28f3f7813d1a8f8b5b9bb3d8f5931652 Size (Math-Prime-Util-0.59.tar.gz) = 525349 bytes @ 1.9 log @Update to 0.58 Upstream changes: 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. @ text @d1 1 a1 1 $NetBSD: distinfo,v 1.8 2016/02/14 11:44:19 wen Exp $ d3 4 a6 4 SHA1 (Math-Prime-Util-0.58.tar.gz) = 75124da5144d4bca88dabf28d26e66154aa5cdad RMD160 (Math-Prime-Util-0.58.tar.gz) = 35da58a27b3410efc39bef8a47c8b8a3b4eb3757 SHA512 (Math-Prime-Util-0.58.tar.gz) = c47b7bcf5c4d1149e425d47304fc9e7974663c4598d9dc5acce8b34d6f3d46941669ec89a65b18efd48a258bea195a8778ca9aa0572949c7886bb992f585b6a9 Size (Math-Prime-Util-0.58.tar.gz) = 515967 bytes @ 1.8 log @Update to 0.57 Upstream changes: 0.57 2016-01-03 [ADDED] - formultiperm { ... } \@@n loop over multiset permutations - todigits(n[,base[,len]]) convert n to digit array - todigitstring(n[,base[,len]]) convert n to string - fromdigits(\@@d[,base]) convert digit array ref to number - fromdigits(str[,base]) convert string to number - ramanujan_prime_count counts Ramanujan primes in range - vecany { expr } @@n true if any expr is true - vecall { expr } @@n true if all expr are true - vecnone { expr } @@n true if no expr are true - vecnotall { expr } @@n true if not all expr are true - vecfirst { expr } @@n returns first element with expr true [FUNCTIONALITY AND PERFORMANCE] - nth_ramanujan_prime(997) was wrong. Fixed. - Tighten Ramanujan prime bounds. Big speedups for large nth Rp. 0.56 2015-12-13 [ADDED] - is_carmichael(n) Returns 1 if n is a Carmichael number - forcomp { ... } n[,{...}] loop over compositions [FUNCTIONALITY AND PERFORMANCE] - Faster, nonrecursive divisors_from_factors routine. - gcdext(0,0) returns (0,0,0) to match GMP and Pari/GP. - Use better prime count lower/upper bounds from B羹the 2015. - forpart and forcomp both use lexicographic order (was anti-lexico). 0.55 2015-10-19 - Fixed test that was using a 64-bit number on 32-bit machines. [FUNCTIONALITY AND PERFORMANCE] - Speed up PP versions of sieve_prime_cluster, twin_primes, twin_prime_count, nth_twin_prime, primes. 0.54 2015-10-14 [ADDED] - sieve_prime_cluster(low,high[,...]) find prime clusters [Misc] - Certain small primes used to return false with Frobenius and AES Lucas tests when given extra arguments. Both are unusual cases never used by the main system. Fixed. 0.53 2015-09-05 [ADDED] - ramanujan_tau(n) Ramanujan's Tau function - sumdigits(n[,base]) sum digits of n [FUNCTIONALITY AND PERFORMANCE] - Don't use Math::MPFR unless underlying MPFR library is at least 3.x. - Use new Math::Prime::Util::GMP::sigma function for divisor_sum. - Use new Math::Prime::Util::GMP::sieve_twin_primes(a,b). 0.52 2015-08-09 [ADDED] - is_square_free(n) Check for repeated factors [FUNCTIONALITY AND PERFORMANCE] - print_primes with 2 args was sending to wrong fileno. - Double speed of sum_primes. - Rewrote some internal sieve-walking code, speeds up next_prime, forprimes, print_primes, and more. - Small speedup for forcomposites / foroddcomposites. - Small speedup for is_prime with composite 32+ bit inputs. - is_frobenius_khashin_pseudoprime now uses Montgomery math for speed. - PrimeArray now treats skipping forward by relatively small amounts as forward iteration. This makes it much more efficient for many cases, but does open up some pathological cases. - PrimeArray now allows exporting @@primes (and a few others), which saves some typing. - PrimeArray now works for indices up to 2^32-1, after which it silently rolls over. Previously it worked to 2^31-1 then croaked. - PrimeIterator now uses small segments instead of always next_prime. A little more memory, but 2-4x faster. - factor, divisor, fordivisors and some others should better keep bigint types (e.g. Math::GMPz input yields Math::GMPz output). - Faster GCD on some platforms. - Peter Dettman supplied a patch for Shawe-Taylor prime generation to make it deterministically match reference implementations. Thanks! [Misc] - Check for old MPFR now using C library version, not module version. - prime_count_{lower,upper} now uses MPFR to give full precision. - Montgomery math and uint128_t enabled on Darwin/clang. 0.51 2015-06-21 [ADDED] - sum_primes(lo,hi) Summation of primes in range - print_primes(lo,hi[,fd]) Print primes to stdout or fd - is_catalan_pseudoprime(n) Catalan primality test - is_frobenius_khashin_pseudoprime(n) Khashin's 2013 Frobenius test [FUNCTIONALITY AND PERFORMANCE] - Slightly faster PP sieving using better code from Perlmonks. - Lucas sequence works with even valued n. - Used idea from Colin Wright to speed up is_perrin_pseudoprime 5x. We can check smaller congruent sequences for composites as a prefilter. - is_frobenius_pseudoprime no longer checks for perfect squares, and doesn't bail to BPSW if P,Q,D exceed n. This makes it produce some pseudoprimes it did not before (but ought to have). [Misc] - Work with old MPFR (some test failures in older Win32 systems). - Don't assert in global destructor if a MemFree object is destroyed. 0.50 2015-05-03 [ADDED] - harmfrac(n) (num,den) of Harmonic number - harmreal(n) Harmonic number as BigFloat - sqrtint(n) Integer square root of n - vecextract(\@@arr, mask) Return elements from arr selected by mask - ramanujan_primes(lo,hi) Ramanujan primes R_n in [lo,hi] - nth_ramanujan_prime(n) the nth Ramanujan prime R_n - is_ramanujan_prime(n) 1 if n is a Ramanujan prime, 0 otherwise [FUNCTIONALITY AND PERFORMANCE] - Implement single-base hashed M-R for 32-bit inputs, inspired by Fori禳ek and Jan�ina 2015 as well as last year's tests with 2-base (2^49) and 3-base (2^64) hashed solutions for MPU. Primality testing is 20-40% faster for this size. - Small speedups for znlog. - PP nth_prime on 32-bit fixed for values over 2^32. [Misc] - Changes to nth_prime_{lower,upper}. They use the Axler (2013) bounds, and the XS code will also use inverse prime count bounds for small values. This gives 2-10x tighter bounds. - Tighten prime count bounds using Axler, Kotnik, B羹the. Thanks to Charles R Greathouse IV for pointing me to these. 0.49 2014-11-30 - Make versions the same in all packages. 0.48 2014-11-28 [ADDED] - lucasu(P, Q, k) U_k for Lucas(P,Q) - lucasv(P, Q, k) V_k for Lucas(P,Q) [Misc] - Use Axler (2014) bounds for prime count where they improve on Dusart. 0.47 2014-11-18 [ADDED] - is_mersenne_prime(p) returns 1 iff 2^p-1 is prime [FUNCTIONALITY AND PERFORMANCE] - Standalone compilation (e.g. factoring without Perl installed) is easier. - For next_prime and prev_prime with bigints, stay in XS as long as possible to cut overhead. Up to 1.5x faster. - Factoring on 64-bit platforms is faster for 32-bit inputs. - AKS is faster for larger than half-word inputs, especially on 64-bit machines with gcc's 128-bit types. - is_provable_prime goes through XS first, so can run *much* faster for small inputs. [OTHER] - NetBSD improperly exports symbols in string.h, including popcount. Rename our internal function to work around it. - is_power now takes an optional scalar reference third argument which will be set to the root if found. It also works for negative n. - Changes to trim a little memory use. lucas_sequence goes from PP->[XS,GMP,PP] to XS[->PP[->GMP]]. ecm_factor is moved out of root. Moved some primality proving logic out of root. - primes.pl when given one argument will show primes up to that number. 0.46 2014-10-21 [API Changes] - is_pseudoprime has the same signature as is_strong_pseudoprime now. This means it requires one or more bases and has no default base. The documentation had never mentioned the default, so this should have little impact, and the common signature makes more sense. [ADDED] - hammingweight(n) Population count (count binary 1s) - vecreduce {...} @@v Reduce/fold, exactly like List::Util::reduce [Misc] - Syntax fix from Salvatore. - vecmin / vecmax in XS, if overflows UV do via strings to avoid PP. - Add example for verifying prime gaps, similar to Nicely's cglp4. - divisor_sum wasn't running XS code for k=0. Refactor PP code, includes speedup when input is a non-Math::BigInt (e.g. Math::GMP). - Improve test coverage. [PP Updates] - Large speedup for divisors with bigints in 64-100 bit range. - Revamp RiemannZeta. Fixes some bignum output, but requires RT fixes. - Optimization for PP comparison to ~0. - PP factoring is faster, especially for small inputs. 0.45 2014-09-26 [ADDED] - forcomb { ... } n, k combinations iterator - forperm { ... } n permutations iterator - factorial(n) n! - is_bpsw_prime(n) primality test with no pretests, just ES BPSW - is_frobenius_pseudoprime Frobenius quadratic primality test - is_perrin_pseudoprime Perrin primality test (unrestricted) - vecmin(@@list) minimum of list of integers - vecmax(@@list) maximum of list of integers - vecprod(@@list) product of list of integers - bernfrac(n) (num,den) of Bernoulli number - bernreal(n) Bernoulli number as BigFloat - stirling(n,m,[type]) Stirling numbers of first or second kind - LambertW(k) Solves for W in k = W*exp(W) - Pi([digits]) Pi as NV or with requested digits [FUNCTIONALITY AND PERFORMANCE] - znorder algorithm changed from Das to Cohen for ~1% speedup. - factoring sped up a bit for 15-19 digits. - speedup for divisor_sum with very large exponents. [OTHER] - Alias added for the module name "ntheory". The module has grown enough that it seems more appropriate. - Big build change: Try a GMP compilation and add Math::Prime::Util::GMP to dependency list if it succeeds. - Fixed a memory leak in segment_primes / segment_twin_primes introduced in previous release. Thanks Valgrind! @ text @d1 1 a1 1 $NetBSD: distinfo,v 1.7 2015/11/03 23:33:39 agc Exp $ d3 4 a6 4 SHA1 (Math-Prime-Util-0.57.tar.gz) = 712da12ef07c63f1790bcd2d4b4c9ef221af0e01 RMD160 (Math-Prime-Util-0.57.tar.gz) = f1cfc60046a8e1a2f38d4870085d479e070ed889 SHA512 (Math-Prime-Util-0.57.tar.gz) = 5909d2cae82187783c56b07c22a90c44f0feb8f5c12cffdf4ec3a1cb4996dbaaae8f917790cdaa4b970cc2302242b941f2ef34097578c7e994275d2c0edaac88 Size (Math-Prime-Util-0.57.tar.gz) = 501214 bytes @ 1.7 log @Add SHA512 digests for distfiles for math category Problems found locating distfiles: Package dfftpack: missing distfile dfftpack-20001209.tar.gz Package eispack: missing distfile eispack-20001130.tar.gz Package fftpack: missing distfile fftpack-20001130.tar.gz Package linpack: missing distfile linpack-20010510.tar.gz Package minpack: missing distfile minpack-20001130.tar.gz Package odepack: missing distfile odepack-20001130.tar.gz Package py-networkx: missing distfile networkx-1.10.tar.gz Package py-sympy: missing distfile sympy-0.7.6.1.tar.gz Package quadpack: missing distfile quadpack-20001130.tar.gz Otherwise, existing SHA1 digests verified and found to be the same on the machine holding the existing distfiles (morden). All existing SHA1 digests retained for now as an audit trail. @ text @d1 1 a1 1 $NetBSD: distinfo,v 1.6 2014/09/04 07:09:56 wen Exp $ d3 4 a6 4 SHA1 (Math-Prime-Util-0.43.tar.gz) = 74b93fbced62cb71ed92be0d3993271863e14ede RMD160 (Math-Prime-Util-0.43.tar.gz) = e5804faf9a2e04261f4ecf2e71fa0d721fd23dc4 SHA512 (Math-Prime-Util-0.43.tar.gz) = 63afeb345f6211c32ed2d8632be03d4cf0afc6fe913baf3a7e41b0608e2678a4191f07d76ee77c797ca9d5a80756e92286a96ef1cbb58d95deca9add0f04d494 Size (Math-Prime-Util-0.43.tar.gz) = 415752 bytes @ 1.6 log @Update to 0.43 Upstream changes please visit: http://cpansearch.perl.org/src/DANAJ/Math-Prime-Util-0.43/Changes @ text @d1 1 a1 1 $NetBSD: distinfo,v 1.5 2013/08/25 01:28:38 wen Exp $ d5 1 @ 1.5 log @Update to 0.31 Upstream changes: 0.31 2013-08-07 - Change proof certificate documentation to reflect the new text format. - Some platforms were using __int128 when it wasn't supported. Only x86_64 and Power64 use it now. - Small speedup for ranged totient internals. - Patch MPU::GMP 0.13 giving us not quite what we expected from a small certificate. Fixed in MPU::GMP 0.14, worked around here regardless. 0.30 2013-08-06 [API Changes] - Primality proofs now use the new "MPU Certificate" format, which is text rather than a nested Perl data structure. This is much better for external interaction, especially with non-Perl tools. It is not quite as convenient for all-Perl manipulation. [Functions Added] - is_frobenius_underwood_pseudoprime - is_almost_extra_strong_lucas_pseudoprime - lucas_sequence - pplus1_factor [Enhancements] - Documentation and PP is_prime changed to use extra strong Lucas test from the strong test. This matches what the newest MPU::GMP does. This has no effect at all for numbers < 2^64. No counter-example is known for the standard, strong, extra strong, or almost extra strong (increment 1 or 2) tests. The extra strong test is faster than the strong test and produces fewer pseudoprimes. It retains the residue class properties of the strong Lucas test (where the SPSP-2 pseudoprimes favor residue class 1 and the Lucas pseudoprimes favor residue class -1), hence should retain the BPSW test strength. - XS code for all 4 Lucas tests. - Clean up is_prob_prime, also ~10% faster for n >= 885594169. - Small mulmod speedup for non-gcc/x86_64 platforms, and for any platform with gcc 4.4 or newer. [Bug Fixes] - Fixed a rare refcount / bignum / callback issue in next_prime. @ text @d1 1 a1 1 $NetBSD: distinfo,v 1.4 2013/07/14 06:11:50 wen Exp $ d3 3 a5 3 SHA1 (Math-Prime-Util-0.31.tar.gz) = 50eee181305f5713b624c4c2e7c3aac530b7bd99 RMD160 (Math-Prime-Util-0.31.tar.gz) = 3e2319959bec56b052a5006c919fe2cee1da9dd8 Size (Math-Prime-Util-0.31.tar.gz) = 272237 bytes @ 1.4 log @Update to 0.29 Add missing DEPENDS Upstream changes: 0.29 30 May 2013 - Fix a signed vs. unsigned char issue in ranged moebius. Thanks to the Debian testers for finding this. - XS is_prob_prime / is_prime now use a BPSW-style test (SPRP2 plus extra strong Lucas test) for values over 2^32. This results in up to 2.5x faster performance for large 64-bit values on most machines. All PSP2s have been verified with Jan Feitsma's database. - forprimes now uses a segmented sieve. This (1) allows arbitrary 64-bit ranges with good memory use, and (2) allows nesting on threaded perls. - prime_count_approx for very large values (> 10^36) was very slow without Math::MPFR. Switch to Li+correction for large values if Math::MPFR is not available. - Workaround for MSVC compiler. - Added: is_pseudoprime (Fermat probable prime test) is_lucas_pseudoprime (standard Lucas-Selfridge test) is_extra_strong_lucas_pseudoprime (Mo/Jones/Grantham E.S. Lucas test) 0.28 23 May 2013 - An optimization to nth_prime caused occasional threaded Win32 faults. Adjust so this is avoided. - Yet another XS micro-speedup (PERL_NO_GET_CONTEXT) - forprimes { block } [begin,]end. e.g. forprimes { say } 100; $sum = 0; forprimes { $sum += $_ } 1000,50000; say $sum; forprimes { say if is_prime($_+2) } 10000; # print twin primes - my $it = prime_iterator(10000); say $it->(); This is experimental (that is, the interface may change). 0.27 20 May 2013 - is_prime, is_prob_prime, next_prime, and prev_prime now all go straight to XS if possible. This makes them much faster for small inputs without having to use the -nobigint flag. - XS simple number validation to lower function call overhead. Still a lot more overhead compared to directly calling the XS functions, but it shaves a little bit of time off every call. - Speedup pure Perl factoring of small numbers. - is_prob_prime / is_prime about 10% faster for composites. - Allow '+N' as the second parameter to primes.pl. This allows: primes.pl 100 +30 to return the primes between 100 and 130. Or: primes.pl 'nth_prime(1000000000)' +2**8 - Use EXTENDED_TESTING to turn on extra tests. 0.26 21 April 2013 - Pure Perl factoring: - real p-1 -- much faster and more effective - Fermat (no better than HOLF) - speedup for pbrent - simple ECM - redo factoring mix - New functions: prime_certificate produces a certificate of primality. verify_prime checks a primality certificate. - Pure perl primality proof now uses BLS75 instead of Lucas, so some numbers will be much faster [n-1 only needs factoring to (n/2)^1/3]. - Math::Prime::Util::ECAffinePoint and ECProjectivePoint modules for dealing with elliptic curves. 0.25 19 March 2013 - Speed up p-1 stage 2 factoring. Combined with some minor changes to the general factoring combination, ~20% faster for 19 digit semiprimes. - New internal macro to loop over primary sieve starting at 2. Simplifies code in quite a few places. - Forgot to skip one of the tests with broken 5.6.2. 0.24 10 March 2013 - Fix compilation with old pre-C99 strict compilers (decl after statement). - euler_phi on a range wasn't working right with some ranges. - More XS prime count improvements to speed and space. Add some tables to the sieve count so it runs a bit faster. Transition from sieve later. - PP prime count for 10^9 and larger is ~2x faster and uses much less memory. Similar impact for nth_prime 10^8 or larger. - Let factor.pl accept expressions just like primes.pl. 0.23 5 March 2013 - Replace XS Zeta for x > 5 with series from Cephes. It is 1 eps more accurate for a small fraction of inputs. More importantly, it is much faster in range 5 < x < 10. This only affects non-integer inputs. - PP Zeta code replaced (for no-MPFR, non-bignums) with new series. The new code is much more accurate for small values, and *much* faster. - Add consecutive_integer_lcm function, just like MPU::GMP's (though we define ci_lcm(0) = 0, which should get propogated). - Implement binary search on RiemannR for XS nth_prime when n > 2e11. Runs ~2x faster for 1e12, 3x faster for 1e13. Thanks to Programming Praxis for the idea and motivation. - Add the first and second Chebyshev functions (theta and psi). - put isqrt(n) in util.h, use it everywhere. put icbrt(n) in lehmer.h, use it there. - Start on Lagarias-Miller-Odlyzko prime count. - A new data structure for the phi(x,a) function used by all the fast prime count routines. Quite a bit faster and most importantly, uses half the memory of the old structure. - Performance: - Divisor sum with no sub is ~10x faster. - Speed up PP version of exp_mangoldt, create XS version. - Zeta much faster as mentioned above. - faster nth_prime as mentioned above. - AKS about 10% faster. - Unroll a little more in sieve inner loop. A couple percent faster. - Faster prime_count and nth_prime due to new phi(x,a) (about 1.25x). 0.22 26 February 2013 - Move main factor loop out of xs and into factor.c. - Totient and Moebius now have complete XS implementations. - Ranged totient uses less memory when segmented. - Switch thread locking to pthreads condition variables. 0.21 22 February 2013 - Switch to using Bytes::Random::Secure for random primes. This is a big change in that it is the first non-CORE module used. However, it gets rid of lots of possible stupidness from system rand. - Spelling fixes in documentation. - primes.pl: Add circular and Panaitopol primes. - euler_phi and moebius now will compute over a range. - Add mertens function: 1000+ times faster than summing moebius($_). - Add exp_mangoldt function: exponential of von Mangoldt's function. - divisor_sum defaults to sigma if no sub is given (i.e. it sums). - Performance: - Speedup factoring small numbers. With -nobigint factoring from 1 to 10M, it's 1.2x faster. 1.5x faster than Math::Factor::XS. - Totient and M枚bius over a range are much faster than separate calls. - divisor_sum is 2x faster. - primes.pl is much faster with Pillai primes. - Reduce overhead in euler_phi -- about 2x faster for individual calls. 0.20 3 February 2013 - Speedup for PP AKS, and turn off test on 32-bit machines. - Replaced fast sqrt detection in PP.pm with a slightly slower version. The bloom filter doesn't work right in 32-bit Perl. Having a non-working detector led to really bad performance. Hence this and the AKS change should speed up testing on some 32-bit machines by a huge amount. - Fix is_perfect_power in XS AKS. 0.19 1 February 2013 - Update MR bases with newest from http://miller-rabin.appspot.com/. - Fixed some issues when using bignum and Calc BigInt backend, and bignum and Perl 5.6. - Added tests for bigint is_provable_prime. - Added a few tests to give better coverage. - Adjust some validation subroutines to cut down on overhead. 0.18 14 January 2013 - Add random_strong_prime. - Fix builds with Solaris 9 and older. - Add some debug info to perhaps find out why old ActiveState Perls are dying in Math::BigInt::Calc, as if they were using really old versions that run out of memory trying to calculate '2 ** 66'. http://code.activestate.com/ppm/Math-Prime-Util/ 0.17 20 December 2012 - Perl 5.8.1 - 5.8.7 miscalculates 12345 ** 4, which I used in a test. - Fix (hopefully) for MSC compilation. - Unroll sieve loop for another 20% or so speedup. It won't have much practical application now that we use Lehmer's method for counts, but there are some cases that can still show speedups. - Changed the rand functionality yet again. Sorry. This should give better support for plugging in crypto RNG's when used from other modules. 0.16 11 December 2012 - randbits >= 32 on some 32-bit systems was messing us up. Restrict our internal randbits to wordsize-1. @ text @d1 1 a1 1 $NetBSD: distinfo,v 1.3 2012/12/10 13:35:45 wen Exp $ d3 3 a5 3 SHA1 (Math-Prime-Util-0.29.tar.gz) = 8e75797a22174c0371f2a6fe885ad1d55b161830 RMD160 (Math-Prime-Util-0.29.tar.gz) = 6feb9e812cf436d9757d630e9dc377112ebdbf84 Size (Math-Prime-Util-0.29.tar.gz) = 256271 bytes @ 1.3 log @Update to 0.15 Upstream changes: 0.15 9 December 2012 - Lots of internal changes to Ei, li, Zeta, and R functions: - Native Zeta and R have slightly more accurate results. - For bignums, use Math::MPFR if possible. MUCH faster. Also allows extended precision while still being fast. - Better accuracy for standard bignums. - All four functions do: - XS if native input. - MPFR to whatever accuracy is desired, if Math::MPFR installed. - BigFloat versions if no MPFR and BigFloat input. - standard version if no MPFR and not a BigFloat. - Add tests for primorial, jordan_totient, and divisor_sum. - Revamp of the random_prime internals. Also fixes some issues with random n-bit and maurer primes. - The random prime and primorial functions now will return a Math::BigInt object if the result is greater than the native size. This includes loading up the Math::BigInt library if necessary. @ text @d1 1 a1 1 $NetBSD: distinfo,v 1.2 2012/11/30 08:24:50 wen Exp $ d3 3 a5 3 SHA1 (Math-Prime-Util-0.15.tar.gz) = 655a44be5b1a93c1f5e90b8da459966721f32c42 RMD160 (Math-Prime-Util-0.15.tar.gz) = c83b3b1519f6dc48a3daf26b429a34391bf52242 Size (Math-Prime-Util-0.15.tar.gz) = 184113 bytes @ 1.2 log @Update to 0.14 Upstream changes: 0.14 29 November 2012 - Compilation and test issues: Fix compilation on NetBSD Try to fix compilation on Win32 + MSVC Speed up some testing, helps a lot with Cygwin on slow machines Speed up a lot of slow PP areas, especially used by test suite - XS AKS extended from half-word to full-word. - Add functions: jordan_totient generalization of Euler Totient divisor_sum run coderef for every divisor - Allow environment variables MPU_NO_XS and MPU_NO_GMP to turn off XS and GMP support respectively if they are defined and equal to 1. - Lehmer prime count for Pure Perl code, including use in nth_prime. prime count 10^9 using sieve: 71.9s PP sieve 0.47s XS sieve prime count 10^9 using Lehmer: 0.70s PP lehmer 0.03s XS lehmer - Moved bignum Zeta and R to separate file, only loaded when needed. Helpful to get the big rarely-used tables out of the main loading. - Quote arguments to Math::Big{Int,Float} in a few places it wasn't. Math::Big* coerces the input to a signed value if it isn't a string, which causes us all sorts of grief. 0.13 19 November 2012 - Fix an issue with prime count, and make prime count available as a standalone program using primesieve. 0.12 17 November 2012 - Add bin/primes.pl and bin/factor.pl - Add functions: primorial product of primes <= n pn_primorial product of first n primes prime_set_config set config options RiemannZeta export and make accurate for small reals is_provable_prime prove primes after BPSW is_aks_prime prove prime via AKS - Add 'assume_rh' configuration option (default: false) which can be set to allow functions to assume the Riemann Hypothesis. - Use the Schoenfeld bound for Pi(x) (x large) if assume_rh is true. - valgrind testing - Use long doubles for math functions. - Some fixes and speedups for ranged primes(). - In the PP code, use 2 MR bases for more numbers when possible. - Fixup of racing SQUFOF, and switch to use it in factor(). - Complete rewrite of XS p-1 factor routine, includes second stage. - bug fix for prime_count on edge of cache. - prime_count will use Lehmer prime counting algorithm for largish sizes (above 4 million). This is MUCH faster than sieving. - nth_prime now uses the fast Lehmer prime count below the lower limit, then sieves up from there. This makes a big speed difference for inputs over 10^6 or so -- over 100x faster for 10^9 and up. @ text @d1 1 a1 1 $NetBSD: distinfo,v 1.1 2012/10/19 07:30:32 sno Exp $ d3 3 a5 3 SHA1 (Math-Prime-Util-0.14.tar.gz) = a187e9e2e4e829e30ae11eb2ebea18e9d5cc66df RMD160 (Math-Prime-Util-0.14.tar.gz) = 1d575765c29c0ba675ad9f856119a7320c14b604 Size (Math-Prime-Util-0.14.tar.gz) = 174944 bytes @ 1.1 log @Add new package for CPAN module Math::Prime::Util version 0.11 into math/p5-Math-Prime-Util. A set of utilities related to prime numbers. These include multiple sieving methods, is_prime, prime_count, nth_prime, approximations and bounds for the prime_count and nth prime, next_prime and prev_prime, factoring utilities, and more. @ text @d1 1 a1 1 $NetBSD: distinfo,v 1.1.1.1 2012/05/03 09:07:30 wiz Exp $ d3 3 a5 3 SHA1 (Math-Prime-Util-0.11.tar.gz) = 6367b8438eddc0cfde6f9129a64c75f6a4f43b98 RMD160 (Math-Prime-Util-0.11.tar.gz) = 3f861e4ec28d8b23d4d0da7e4df76ac20ba5aeda Size (Math-Prime-Util-0.11.tar.gz) = 119319 bytes @