Copyright | 2021 Preetham Gujjula |
---|---|
License | BSD-3-Clause |
Maintainer | libraries@mail.preetham.io |
Stability | experimental |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
This module provides a high-level, polymorphic interface to the primecount library. For a lower-level interface, see Math.NumberTheory.Prime.Count.FFI.
Synopsis
- primePi :: Integral a => a -> a
- primePiMaxBound :: Integer
- nthPrime :: Integral a => a -> a
- nthPrimeMaxBound :: Integer
- primePhi :: Integral a => a -> a -> a
- getNumPrimecountThreads :: IO Int
- setNumPrimecountThreads :: Int -> IO ()
- primecountVersion :: String
Documentation
primePi :: Integral a => a -> a Source #
The number of primes less than or equal to n
. Throws an error if n
is larger than primePiMaxBound
. Also might throw an error if there's not
enough memory available to compute the result, which can happen even if n
is smaller than primePiMaxBound
.
primePiMaxBound :: Integer Source #
The largest input supported by primePi
.
- 64-bit CPUs:
10^31
- 32-bit CPUs:
2^63 - 1
nthPrime :: Integral a => a -> a Source #
The nth prime, starting at nthPrime 1 == 2
.
- Throws an error if the input is less than 1.
- Throws an error if the input is larger than
nthPrimeMaxBound
.
getNumPrimecountThreads :: IO Int Source #
Get the currently set number of threads used by libprimecount
.
setNumPrimecountThreads :: Int -> IO () Source #
Set the number of threads used by libprimecount
. If the input is not
positive, the thread count is set to 1. If the input is greater than the
number of CPUs available, the thread count is set to the number of CPUs
available.
primecountVersion :: String Source #
Get the libprimecount
version number, in the form "i.j"