factory-0.2.1.1: Rational arithmetic in an irrational world.

Safe HaskellSafe-Inferred
LanguageHaskell98

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 Algorithmic algorithm where Source

Defines the methods expected of a primality-testing algorithm.

Methods

isPrime :: (NFData i, Integral i, Show i) => algorithm -> i -> Bool Source

Instances

Algorithmic factorisationAlgorithm => Algorithmic (Algorithm factorisationAlgorithm) 

Functions

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

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

Predicates

areCoprime :: Integral i => i -> i -> Bool Source

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

isFermatWitness :: (Integral i, Show i) => i -> Bool Source

isCarmichaelNumber :: (Algorithmic algorithm, NFData i, Integral i, Show i) => algorithm -> i -> Bool Source