Safe Haskell | Safe-Inferred |
---|---|

Language | Haskell2010 |

# Unique factorization domain

Specifically, a UFD is an integral domain (a nontrivial commutative ring in which the product of any two non-zero elements is non-zero) in which every non-zero non-unit element can be written as a product of prime elements (or irreducible elements), uniquely up to order and units.

# Documentation

class Num a => UFD a where Source #

factor :: a -> [(a, Int)] Source #

factor *x*

Factor *x* into `prime`

factors \(x = p_1^{e_1}\ldots p_n^{e_n}\)
with the representation \([(p_1, e_1) \ldots (p_n, e_n)]\)

unfactor :: [(a, Int)] -> a Source #

unfactor *f*

Find *x* which has the unique factorization *f*.