primecount-0.1.0.0: Bindings to the primecount library
Copyright2021 Preetham Gujjula
LicenseBSD-3-Clause
Maintainerlibraries@mail.preetham.io
Stabilityexperimental
Safe HaskellSafe-Inferred
LanguageHaskell2010

Math.NumberTheory.Prime.Count

Description

This module provides a high-level, polymorphic interface to the primecount library. For a lower-level interface, see Math.NumberTheory.Prime.Count.FFI.

Synopsis

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.

nthPrimeMaxBound :: Integer Source #

The largest input supported by nthPrime, equal to primePi (maxBound :: Int64) == 216289611853439384.

primePhi :: Integral a => a -> a -> a Source #

primePhi n a counts the number of positive integers <= n that are not divisible by any of the first a primes. Throws an error if n is larger than maxBound :: Int64.

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"