The C formula in Gourdon’s prime-counting algorithm now runs approximately twice as fast, improving primecount’s overall performance by up to 20%. The improved C algorithm is described in section 6 of Easy-Special-Leaves.pdf. Thanks to @ChopperLin the memory usage has been reduced by about 32% in the range [6.5e22, 2.5e26].
ChangeLog
- primecount now requires C++14 or later (only for building, linking still works with C++11).
nth_prime_sieve.cpp: Fix rare OpenMP multi-threading bug.- Fix GCC/Clang
-Wundefwarnings. PiTable.cpp: Add multi-threaded primes vector initialization, #134.FactorTableD.hpp: Reduce Gourdon D memory using 16-bit prime factor ordinals, #133.primecount.pc.in: Add missing libatomic and libquadmath dependencies, #132.primecountConfig.cmake.in: Only find OpenMP when required.ci.yml: Add pkg-config and CMakefind_package()CI tests.D_arm_sve.hpp: Fix GCC ARM SVE failed auto-vectorization, #130.- Fix
get_max_x()for x > 10^31. CmdOptions.cpp: Detect too many input numbers.P2.cpp: Fix potential 64-bit integer overflow.phi.cpp: Fixphi(x, a)for x >= 4611686065672028281 which requires primes >INT32_MAX.lmo/*.cpp: Fixint32_tprimes overflow, #129.api.cpp: Fixnth_prime()error message.api.cpp: Fix 128-bitnth_prime()for negative inputs.main.cpp: Validate 128-bit to 64-bit integer conversions.LoadBalancerS2.cpp: Fix Clang scaling issue.AC.cpp: Improve clustered easy leaves algorithm using Gourdon's inversion equality.AC.cpp: Implement segmented C1 algorithm to improve cache efficiency, #128.AC.cpp: Use multi-threading to initialize the libdivide vector.util.cpp: Retune Gourdon alpha factors due to improved C algorithm.test.cpp: Improve test coverage using alternatealpha_zvalues.doc/Easy-Special-Leaves.pdf: Add description of new C algorithm.doc/alpha-factor-gourdon.pdf: Retune Gourdon alpha factors.