This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)


yields True if expr is a prime number, and yields False otherwise.
  • PrimeQ[m+In] automatically works over the Gaussian integers.
  • Simplify[exprPrimes] can be used to try to determine whether a symbolic expression is mathematically a prime.
Test whether a number is prime:
Test whether a number is prime:
Click for copyable input
Click for copyable input
PrimeQ threads itself element-wise over lists:
Test for primality over the Gaussian integers:
Only some numbers of the form are prime:
Highlight numbers that are prime:
The distribution of Gaussian primes:
New in 1 | Last modified in 5