HaskellForMaths-0.4.9: Combinatorics, group theory, commutative algebra, non-commutative algebra

Safe HaskellNone
LanguageHaskell98

Math.NumberTheory.Prime

Description

A module providing functions to test for primality, and find next and previous primes.

Synopsis

Documentation

primes :: [Integer] Source #

A (lazy) list of the primes

isPrime :: Integer -> Bool Source #

Is this number prime? The algorithm consists of using trial division to test for very small factors, followed if necessary by the Miller-Rabin probabilistic test.

prevPrime :: Integer -> Integer Source #

Given n, prevPrime n returns the greatest p, p < n, such that p is prime

nextPrime :: Integer -> Integer Source #

Given n, nextPrime n returns the least p, p > n, such that p is prime