[−][src]Trait maths_traits::algebra::ring_like::Primality
Methods for testing irreduciblity and primality
Do note that for obvious reasons these methods should be assumed to be expensive by default. Furthermore, given the difficulty of checking irreduciblity or primality for general rings, it is entirely possible that there is simply no good algorithm for doing so, and as such, this trait is not a requirement for any of the ring categorization traits.
Furthermore, it is important to note that in general, while all primes are irreducible, the notions are not synonymous. In particular, in Z[sqrt(5)], 3 is irreducible but is not prime. However, if all pairs of elements have a GCD, then all irreducibles are prime as well.
Required methods
fn irreducible(&self) -> bool
Determines if this element cannot be produced from the product of two other non-invertible elements
fn prime(&self) -> bool
Determines if this element is prime
An element x
is prime if when y
is a multiple of x
, a*b=y
implies that x
divides
either a
or b
. Do note that this implies irreduciblity.