represents the domain of prime numbers, as in xPrimes.


  • xPrimes evaluates only if x is a numeric quantity.
  • Simplify[exprPrimes] can be used to try to determine whether an expression corresponds to a prime number.
  • The domain of primes is taken to be a subset of the domain of integers.
  • PrimeQ[expr] returns False unless expr explicitly has head Integer.
  • Primes is output in TraditionalForm as TemplateBox[{}, Primes]. This typeset form can be input using pris.


open allclose all

Basic Examples  (3)

The number is a prime:

Fermat's little theorem:

Find primes satisfying an inequality:

Scope  (4)

Test domain membership of a numeric expression:

Make domain membership assumptions:

Specify the default domain for Reduce and FindInstance:

TraditionalForm formatting:

Applications  (2)

Wilson's theorem [more info]:

A list of twin primes:


Properties & Relations  (3)

Primes is contained in Complexes, Reals, Algebraics, Rationals, and Integers:

Simplifications involving prime numbers:

Primes represents the set of positive integers that are prime:

PrimeQ gives True if an integer, positive or negative, is prime:

PrimeQ returns True for explicit numeric primes and False otherwise:

Element remains unevaluated when it cannot decide whether an expression is a prime:

Wolfram Research (1999), Primes, Wolfram Language function, (updated 2017).


Wolfram Research (1999), Primes, Wolfram Language function, (updated 2017).


@misc{reference.wolfram_2021_primes, author="Wolfram Research", title="{Primes}", year="2017", howpublished="\url{}", note=[Accessed: 21-June-2021 ]}


@online{reference.wolfram_2021_primes, organization={Wolfram Research}, title={Primes}, year={2017}, url={}, note=[Accessed: 21-June-2021 ]}


Wolfram Language. 1999. "Primes." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2017.


Wolfram Language. (1999). Primes. Wolfram Language & System Documentation Center. Retrieved from