next | previous | forward | backward | up | top | index | toc | home

isPrime -- whether a integer, polynomial, or ideal is prime

Synopsis

Description

i1 : isPrime 91

o1 = false
i2 : isPrime 101

o2 = true
i3 : isPrime 31991

o3 = true
i4 : isPrime 32003

o4 = true
i5 : ZZ/2[t];
i6 : isPrime(t^2+t+1)

o6 = true
i7 : isPrime(t^2+1)

o7 = false
This function can be used to determine whether an ideal in a polynomial ring is prime.
i8 : R = QQ[a..d];
i9 : I = monomialCurveIdeal(R,{1,5,8})

               2    2      3    2 2   3     3    5        3   5    4
o9 = ideal (a*c  - b d, b*c  - a d , b c - a d, c  - a*b*d , b  - a c)

o9 : Ideal of R
i10 : isPrime I

o10 = true

Caveat

At the moment, for integers larger than 2^31-1 it checks for divisibility by small primes, and then applies a strong pseudoprimality test (Rabin-Miller) to the base 2.

See also

Ways to use isPrime :