1PRIMECOUNT(1)                                                    PRIMECOUNT(1)
2
3
4

NAME

6       primecount - count prime numbers
7

SYNOPSIS

9       primecount x [options]
10

DESCRIPTION

12       Count the number of primes less than or equal to x (<= 10^31) using
13       fast implementations of the combinatorial prime counting function
14       algorithms. By default primecount counts primes using Xavier Gourdon’s
15       algorithm which has a runtime complexity of O(x^(2/3) / log^2 x)
16       operations and uses O(x^(2/3) * log^3 x) memory. primecount is
17       multi-threaded, it uses all available CPU cores by default.
18

OPTIONS

20       -d, --deleglise-rivat
21           Count primes using the Deleglise-Rivat algorithm.
22
23       -g, --gourdon
24           Count primes using Xavier Gourdon’s algorithm (default algorithm).
25
26       -l, --legendre
27           Count primes using Legendre’s formula.
28
29       --lehmer
30           Count primes using Lehmer’s formula.
31
32       --lmo
33           Count primes using the Lagarias-Miller-Odlyzko algorithm.
34
35       -m, --meissel
36           Count primes using Meissel’s formula.
37
38       --Li
39           Approximate pi(x) using the logarithmic integral.
40
41       --Li-inverse
42           Approximate the nth prime using Li^-1(x).
43
44       -n, --nth-prime
45           Calculate the nth prime.
46
47       -p, --primesieve
48           Count primes using the sieve of Eratosthenes.
49
50       --phi X A
51           phi(x, a) counts the numbers <= x that are not divisible by any of
52           the first a primes.
53
54       --Ri
55           Approximate pi(x) using the Riemann R function.
56
57       --Ri-inverse
58           Approximate the nth prime using Ri^-1(x).
59
60       -s, --status[=NUM]
61           Show the computation progress e.g. 1%, 2%, 3%, ... Show NUM digits
62           after the decimal point: --status=1 prints 99.9%.
63
64       --test
65           Run various correctness tests and exit.
66
67       --time
68           Print the time elapsed in seconds.
69
70       -t, --threads=NUM
71           Set the number of threads, 1 <= NUM <= CPU cores. By default
72           primecount uses all available CPU cores.
73
74       -v, --version
75           Print version and license information.
76
77       -h, --help
78           Print this help menu.
79

ADVANCED OPTIONS FOR THE DELEGLISE-RIVAT ALGORITHM

81       --P2
82           Compute the 2nd partial sieve function.
83
84       --S1
85           Compute the ordinary leaves.
86
87       --S2-trivial
88           Compute the trivial special leaves.
89
90       --S2-easy
91           Compute the easy special leaves.
92
93       --S2-hard
94           Compute the hard special leaves.
95
96   Tuning factor
97       The alpha tuning factor mainly balances the computation of the S2_easy
98       and S2_hard formulas. By increasing alpha the runtime of the S2_hard
99       formula will usually decrease but the runtime of the S2_easy formula
100       will increase. For large pi(x) computations with x >= 10^25 you can
101       usually achieve a significant speedup by increasing alpha.
102
103       The alpha tuning factor is also very useful for verifying pi(x)
104       computations. You compute pi(x) twice but for the second computation
105       you use a slightly different alpha factor. If the results of both pi(x)
106       computations match then pi(x) has been verified successfully.
107
108       -a, --alpha=NUM
109           Set the alpha tuning factor: y = x^(1/3) * alpha, 1 <= alpha <=
110           x^(1/6).
111

ADVANCED OPTIONS FOR XAVIER GOURDON’S ALGORITHM

113       --AC
114           Compute the A + C formulas.
115
116       --B
117           Compute the B formula.
118
119       --D
120           Compute the D formula.
121
122       --Phi0
123           Compute the Phi0 formula.
124
125       --Sigma
126           Compute the 7 Sigma formulas.
127
128   Tuning factors
129       The alpha_y and alpha_z tuning factors mainly balance the computation
130       of the A, B, C and D formulas. When alpha_y is decreased but alpha_z is
131       increased then the runtime of the B formula will increase but the
132       runtime of the A, C and D formulas will decrease. For large pi(x)
133       computations with x >= 10^25 you can usually achieve a significant
134       speedup by decreasing alpha_y and increasing alpha_z. For convenience
135       when you increase alpha_z using --alpha-z=NUM then alpha_y is
136       automatically decreased.
137
138       Both the alpha_y and alpha_z tuning factors are also very useful for
139       verifying pi(x) computations. You compute pi(x) twice but for the
140       second computation you use a slightly different alpha_y or alpha_z
141       factor. If the results of both pi(x) computations match then pi(x) has
142       been verified successfully.
143
144       --alpha-y=NUM
145           Set the alpha_y tuning factor: y = x^(1/3) * alpha_y, 1 <= alpha_y
146           <= x^(1/6).
147
148       --alpha-z=NUM
149           Set the alpha_z tuning factor: z = y * alpha_z, 1 <= alpha_z <=
150           x^(1/6).
151

EXAMPLES

153       primecount 1000
154           Count the primes <= 1000.
155
156       primecount 1e17 --status
157           Count the primes <= 10^17 and print status information.
158
159       primecount 1e15 --threads 1 --time
160           Count the primes <= 10^15 using a single thread and print the time
161           elapsed.
162

HOMEPAGE

164       https://github.com/kimwalisch/primecount
165

AUTHOR

167       Kim Walisch <kim.walisch@gmail.com>
168
169
170
171                                  07/21/2023                     PRIMECOUNT(1)
Impressum