arithmoi-0.11.0.0: Efficient basic number-theoretic functions.

Copyright (c) 2018 Alexandre Rodrigues Baldé MIT Alexandre Rodrigues Baldé None Haskell2010

Contents

Description

This module exports functions for manipulating Eisenstein integers, including computing their prime factorisations.

Synopsis

Documentation

An Eisenstein integer is a + bω, where a and b are both integers.

Constructors

 (:+) infix 6 Fieldsreal :: !Integer imag :: !Integer
Instances
 Source # Instance details Methods Source # Instance details Methods Source # Instance details Methods Source # Instance details MethodsshowList :: [EisensteinInteger] -> ShowS # Source # Instance details Associated Typestype Rep EisensteinInteger :: Type -> Type # Methods Source # Instance details Methodsrnf :: EisensteinInteger -> () # Source # Instance details Methods Source # Instance details Methods Source # Instance details Methods Source # Instance details Methods Source # See the source code and Haddock comments for the factorise and isPrime functions in this module (they are not exported) for implementation details. Instance details Methods Source # Instance details type Rep EisensteinInteger = D1 (MetaData "EisensteinInteger" "Math.NumberTheory.Quadratic.EisensteinIntegers" "arithmoi-0.11.0.0-GC1gQiNKoSR4YxT4GQqfcr" False) (C1 (MetaCons ":+" PrefixI True) (S1 (MetaSel (Just "real") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Integer) :*: S1 (MetaSel (Just "imag") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Integer)))

The imaginary unit for Eisenstein integers, where

ω == (-1/2) + ((sqrt 3)/2)ι == exp(2*pi*ι/3)

and ι is the usual imaginary unit with ι² == -1.

Conjugate a Eisenstein integer.

The square of the magnitude of a Eisenstein integer.

Produce a list of an EisensteinInteger's associates.

List of all Eisenstein units, counterclockwise across all sextants, starting with 1.

Primality functions

Find an Eisenstein integer whose norm is the given prime number in the form 3k + 1.

>>> findPrime (nextPrime 7)
Prime 3+2*ω


An infinite list of Eisenstein primes. Uses primes in Z to exhaustively generate all Eisenstein primes in order of ascending norm.

• Every prime is in the first sextant, so the list contains no associates.
• Eisenstein primes from the whole complex plane can be generated by applying associates to each prime in this list.
>>> take 10 primes
[Prime 2+ω,Prime 2,Prime 3+2*ω,Prime 3+ω,Prime 4+3*ω,Prime 4+ω,Prime 5+3*ω,Prime 5+2*ω,Prime 5,Prime 6+5*ω]