factory-0.3.2.0: Rational arithmetic in an irrational world.

Safe HaskellSafe
LanguageHaskell2010

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.

Minimal complete definition

isPrime

Methods

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

Instances

Algorithmic factorisationAlgorithm => Algorithmic (Algorithm factorisationAlgorithm) Source # 

Methods

isPrime :: (NFData i, Integral i, Show i) => Algorithm factorisationAlgorithm -> i -> Bool Source #

Functions

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

An ordered list of the Carmichael numbers; https://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 #