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

PrimeQ[expr]
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:
In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=
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
Ask a question about this page  |  Suggest an improvement  |  Leave a message for the team
Format:   HTML  |  CDF