5.17 IsPrime

IsPrime( r )
IsPrime( R, r )

In the first form IsPrime returns true if the ring element r is a prime in its default ring (see DefaultRing) and false otherwise. In the second form IsPrime returns true if the ring element r is a prime in the ring R and false otherwise.

An element r of a ring R is called prime if for each pair s and t such that r divides s t the element r divides either s or t. Note that there are rings where not every irreducible element (see IsIrreducible) is a prime.

    gap> IsPrime( Integers, 4 );
    false
    gap> IsPrime( Integers, 3 );
    true 

IsPrime calls R.operations.IsPrime( R, r ) and returns the value.

The default function called this way is RingOps.IsPrime, which just signals an error, because there is no generic way to test whether an element is prime. Thus special categories of rings must overlay this default function with other functions.

Previous Up Top Next
Index

GAP 3.4.4
April 1997