Numbers-0.2.1: An assortment of number theoretic functions

Data.Numbers.Primes

Synopsis

Documentation

primes :: [Integer]Source

An infinite list of prime numbers, generated as described here http://www.cs.york.ac.uk/ftpdir/pub/colin/jfp97lw.ps.gz

isPrime :: Integer -> BoolSource

Checks whether a number is prime

isProbablyPrime :: RandomGen g => Integer -> g -> (Bool, g)Source

Performs a Miller Rabin Primality Test. According to the Wikipedia it's false positive with a probability of less than 25%. It's never false negative. Use it several times to increase confidence.