Numbers-0.2.1: An assortment of number theoretic functions




primes :: [Integer]Source

An infinite list of prime numbers, generated as described here

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.