PRIMECOUNT(1) | PRIMECOUNT(1) |
NAME
primecount - count prime numbers
SYNOPSIS
primecount x [options]
DESCRIPTION
Count the number of primes less than or equal to x (<= 10^31) using fast implementations of the combinatorial prime counting function algorithms. By default primecount counts primes using Xavier Gourdon’s algorithm which has a runtime complexity of O(x^(2/3) / log^2 x) operations and uses O(x^(2/3) * log^3 x) memory. primecount is multi-threaded, it uses all available CPU cores by default.
OPTIONS
-d, --deleglise-rivat
-g, --gourdon
-l, --legendre
--lehmer
--lmo
-m, --meissel
--Li
--Li-inverse
-n, --nth-prime
-p, --primesieve
--phi X A
-R, --RiemannR
--RiemannR-inverse
-s, --status[=NUM]
--test
--time
-t, --threads=NUM
-v, --version
-h, --help
ADVANCED OPTIONS FOR THE DELEGLISE-RIVAT ALGORITHM
--P2
--S1
--S2-trivial
--S2-easy
--S2-hard
Tuning factor
The alpha tuning factor mainly balances the computation of the S2_easy and S2_hard formulas. By increasing alpha the runtime of the S2_hard formula will usually decrease but the runtime of the S2_easy formula will increase. For large pi(x) computations with x >= 10^25 you can usually achieve a significant speedup by increasing alpha.
The alpha tuning factor is also very useful for verifying pi(x) computations. You compute pi(x) twice but for the second computation you use a slightly different alpha factor. If the results of both pi(x) computations match then pi(x) has been verified successfully.
-a, --alpha=NUM
ADVANCED OPTIONS FOR XAVIER GOURDON’S ALGORITHM
--AC
--B
--D
--Phi0
--Sigma
Tuning factors
The alpha_y and alpha_z tuning factors mainly balance the computation of the A, B, C and D formulas. When alpha_y is decreased but alpha_z is increased then the runtime of the B formula will increase but the runtime of the A, C and D formulas will decrease. For large pi(x) computations with x >= 10^25 you can usually achieve a significant speedup by decreasing alpha_y and increasing alpha_z. For convenience when you increase alpha_z using --alpha-z=NUM then alpha_y is automatically decreased.
Both the alpha_y and alpha_z tuning factors are also very useful for verifying pi(x) computations. You compute pi(x) twice but for the second computation you use a slightly different alpha_y or alpha_z factor. If the results of both pi(x) computations match then pi(x) has been verified successfully.
--alpha-y=NUM
--alpha-z=NUM
EXAMPLES
primecount 1000
primecount 1e17 --status
primecount 1e15 --threads 1 --time
HOMEPAGE
AUTHOR
Kim Walisch <kim.walisch@gmail.com>
02/17/2024 |