primesieve-0.1.0.1: FFI bindings for the primesieve library.

Safe HaskellNone
LanguageHaskell2010

Math.Prime.FastSieve

Synopsis

Documentation

generatePrimes Source #

Arguments

:: Prime ty 
=> Word64

start

-> Word64

end

-> IO (UArray ty) 

Get an array with the primes inside the interval [start, stop].

generateNPrimes Source #

Arguments

:: Prime ty 
=> Word64

n

-> Word64

start

-> IO (UArray ty) 

Get an array with the first n primes >= start.

nthPrime Source #

Arguments

:: Int64

n

-> Word64

start

-> Word64 

Find the nth prime.

  • if n = 0 finds the 1st prime >= start,
  • if n > 0 finds the nth prime > start,
  • if n < 0 finds the nth prime < start (backwards).

countPrimes Source #

Arguments

:: Word64

start

-> Word64

end

-> Word64 

Count the primes within the interval [start, stop].

countTwins Source #

Arguments

:: Word64

start

-> Word64

end

-> Word64 

Count the twins within the interval [start, stop].

countTriplets Source #

Arguments

:: Word64

start

-> Word64

end

-> Word64 

Count the triplets within the interval [start, stop].

countQuadruplets Source #

Arguments

:: Word64

start

-> Word64

end

-> Word64 

Count the quadruplets within the interval [start, stop].

countQuintuplets Source #

Arguments

:: Word64

start

-> Word64

end

-> Word64 

Count the quintuplets within the interval [start, stop].

countSextuplets Source #

Arguments

:: Word64

start

-> Word64

end

-> Word64 

Count the sextuplets within the interval [start, stop].

printPrimes Source #

Arguments

:: Word64

start

-> Word64

end

-> IO () 

Print the primes within the interval [start, stop] to the standard output.

printTwins Source #

Arguments

:: Word64

start

-> Word64

end

-> IO () 

Print the prime twins within the interval [start, stop] to the standard output.

printTriplets Source #

Arguments

:: Word64

start

-> Word64

end

-> IO () 

Print the prime triplets within the interval [start, stop] to the standard output.

printQuadruplets Source #

Arguments

:: Word64

start

-> Word64

end

-> IO () 

Print the prime quadruplets within the interval [start, stop] to the standard output.

printQuintuplets Source #

Arguments

:: Word64

start

-> Word64

end

-> IO () 

Print the prime quintuplets within the interval [start, stop] to the standard output.

printSextuplets Source #

Arguments

:: Word64

start

-> Word64

end

-> IO () 

Print the prime sextuplets within the interval [start, stop] to the standard output.

getMaxStop :: Word64 Source #

Returns the largest valid stop number for primesieve, 2^64-1 (UINT64_MAX).

setSieveSize :: Int -> IO () Source #

Set the sieve size in kilobytes. The best sieving performance is achieved with a sieve size of your CPU's L1 or L2 cache size (per core).

setNumThreads :: Int -> IO () Source #

Set the number of threads for use in primesieve_count_*() and primesieve_nth_prime(). By default all CPU cores are used.

primesieveVersion :: IO String Source #

Get the primesieve version number, in the form "i.j".