Mathematica 9 is now available
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.
Mathematica > Mathematics and Algorithms > Mathematical Functions > Number Theoretic Functions >

PrimeQ

PrimeQ[expr]
yields True if expr is a prime number, and yields False otherwise.
  • PrimeQ[m+In] automatically works over the Gaussian integers.
  • Simplify[exprElementPrimes] can be used to try to determine whether a symbolic expression is mathematically a prime.
Test whether a number is prime:
PrimeQ threads itself element-wise over lists:
Test for primality over the Gaussian integers:
Only some numbers of the form 2^(2^n)+1 are prime:
Highlight numbers that are prime:
The distribution of Gaussian primes:
New in 1 | Last modified in 5
Ask a question about this page  |  Suggest an improvement  |  Leave a message for the team