factory-0.2.1.1: Rational arithmetic in an irrational world.

Factory.Data.PrimeFactors

Description

`AUTHOR`
Dr. Alistair Ward
`DESCRIPTION`
• Describes a list of prime factors.
• The product of this list of prime-factors represents the composite integer from which they were originally extracted.

Synopsis

# Types

## Type-synonyms

type Factors base exponent = [Exponential base exponent] Source

• Each element of this list represents one prime-factor, expressed as an exponential with a prime base, of the original integer.
• Whilst it only makes sense for both the base and exponent to be integral, these constrains are applied at the function-level as required.

# Functions

insert' :: (Ord base, Num exponent) => Exponential base exponent -> Factors base exponent -> Factors base exponent Source

• Insert a `Exponential`, into a list representing a product of prime factors, multiplying with any incumbent of like base.
• The list should be sorted by increasing base.
• Preserves the sort-order.
• CAVEAT: this is tolerably efficient for sporadic insertion; to insert a list, use `>*<`.

Arguments

 :: (Num base, Integral exponent) => BisectionRatio -> MinLength -> Factors base exponent The list on which to operate. -> base The result.

Multiply a list of prime factors.

reduce :: (Ord base, Num exponent, Ord exponent) => Factors base exponent -> Factors base exponent Source

• Sorts a list representing a product of prime factors by increasing base.
• Multiplies `Exponential`s of similar base.

## Operators

(>*<) :: (Ord base, Num exponent, Ord exponent) => Factors base exponent -> Factors base exponent -> Factors base exponent infixl 7 Source

• Multiplies two lists each representing a product of prime factors, and sorted by increasing base.
• Preserves the sort-order.

(>/<) infixl 7 Source

Arguments

 :: (Integral base, Integral exponent) => Factors base exponent The list of prime factors in the numerator. -> Factors base exponent The list of prime factors in the denominator. -> (Factors base exponent, Factors base exponent) The ratio of numerator and denominator, after like prime factors are cancelled.
• Divides two lists, each representing a product of prime factors, and sorted by increasing base.
• Preserves the sort-order.

(>^) :: Num exponent => Factors base exponent -> exponent -> Factors base exponent infixr 8 Source

• Raise the product of a list prime factors to the specified power.
• CAVEAT: this merely involves raising each element to the specified power; cf. raising a polynomial to a power.