primecountpy.primecount¶
Interface to the primecount C++ library
- primecountpy.primecount.nth_prime(int64_t n) int64_t ¶
Return the
n
-th prime integer.EXAMPLES:
>>> from primecountpy.primecount import nth_prime >>> nth_prime(168) == 997 True
- primecountpy.primecount.phi(int64_t x, int64_t a) int64_t ¶
Return the number of integers smaller or equal than
x
by any of the firsta
primes.This is sometimes called a “partial sieve function” or “Legendre-sum”.
EXAMPLES:
>>> from primecountpy.primecount import phi >>> phi(1000, 3) == 266 True >>> phi(2**30, 100) == 95446716 True
- primecountpy.primecount.prime_pi(int64_t n, method=None) int64_t ¶
Return the number of prime numbers smaller or equal than
n
.INPUT:
n
- an integer
EXAMPLES:
>>> from primecountpy.primecount import prime_pi >>> prime_pi(1000) == 168 True
method has no effect, retained for compatibility:
>>> prime_pi(1000, method='deleglise_rivat') == 168 True
- primecountpy.primecount.prime_pi_128(n)¶
Return the number of prime number smaller than
n
.EXAMPLES:
>>> from primecountpy.primecount import prime_pi_128 >>> prime_pi_128(1000) 168 >>> prime_pi_128(10**10) 455052511
Functions
|
Return the |
|
Return the number of integers smaller or equal than |
|
Return the number of prime numbers smaller or equal than |
|
Return the number of prime number smaller than |