factory-0.0.0.2: Rational arithmetic in an irrational world.

Factory.Math.Primality

Contents

Description

AUTHOR
Dr. Alistair Ward
DESCRIPTION
  • Exports a common interface for primality-implementations.
  • Provides utilities for these implementations.

Synopsis

Type-classes

class Algorithm algorithm whereSource

Defines the methods expected of a primality-algorithm.

Methods

isPrime :: (NFData i, Integral i) => algorithm -> i -> BoolSource

Instances

Algorithm factorisationAlgorithm => Algorithm (Algorithm factorisationAlgorithm) 

Functions

carmichaelNumbers :: (Algorithm algorithm, NFData i, Integral i) => algorithm -> [i]Source

An ordered list of the Carmichael numbers; http://en.wikipedia.org/wiki/Carmichael_number.

Predicates

areCoprime :: Integral i => i -> i -> BoolSource

True if the two specified integers are relatively prime, i.e. if they share no common positive factors except one.

isFermatWitness :: Integral i => i -> BoolSource

isCarmichaelNumber :: (Algorithm algorithm, NFData i, Integral i) => algorithm -> i -> BoolSource