Copyright | 2021 Preetham Gujjula |
---|---|
License | BSD-3-Clause |
Maintainer | libraries@mail.preetham.io |
Stability | experimental |
Safe Haskell | None |
Language | Haskell2010 |
This module provides direct access to the C API of the primecount library. It's recommended that you use the higher-level interface in Math.NumberTheory.Prime.Count.
Documentation adapted from the C API reference
and primecount.h
.
Synopsis
- primecount_pi :: Int64 -> Int64
- primecount_pi_str :: CString -> CString -> CSize -> IO Int
- primecount_nth_prime :: Int64 -> Int64
- primecount_phi :: Int64 -> Int64 -> Int64
- primecount_get_max_x :: CString
- primecount_get_num_threads :: IO Int
- primecount_set_num_threads :: Int -> IO ()
- primecount_version :: CString
Documentation
primecount_pi :: Int64 -> Int64 Source #
Count the number of primes <= x
.
primecount_pi_str :: CString -> CString -> CSize -> IO Int Source #
Count the number of primes <= x (supports 128-bit).
primecount_nth_prime :: Int64 -> Int64 Source #
Find the n
th prime e.g.: primecount_nth_prime 25 == 97
.
primecount_phi :: Int64 -> Int64 -> Int64 Source #
primecount_phi x a
counts the numbers <= x
that are not divisible by
any of the first a
primes.
primecount_get_max_x :: CString Source #
primecount_get_max_x
is the largest number supported by
primecount_pi_str
.
- 64-bit CPUs:
10^31
- 32-bit CPUs:
2^63 - 1
primecount_get_num_threads :: IO Int Source #
Get the currently set number of threads used by libprimecount
.
primecount_set_num_threads :: Int -> IO () Source #
Set the number of threads used by libprimecount
.
primecount_version :: CString Source #
Get the libprimecount
version number, in the form "i.j"
.