a Boolean value, true if f is either a prime integer or an irreducible polynomial and false otherwise
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];
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.