Details and Options
- PrimeQ is typically used to test whether an integer is a prime number.
- A prime number is a positive integer that has no divisors other than 1 and itself.
- PrimeQ[n] returns False unless n is manifestly a prime number.
- For negative integer n, PrimeQ[n] is effectively equivalent to PrimeQ[-n].
- With the setting GaussianIntegers->True, PrimeQ determines whether a number is a Gaussian prime.
- PrimeQ[m+In] automatically works over Gaussian integers.
Examplesopen allclose all
Basic Applications (5)
Special Sequences (11)
Number Theory (6)
Properties & Relations (22)
Primes represents the domain of all prime numbers:
Prime gives prime number:
RandomPrime generates random prime numbers:
The GCD of two prime numbers is 1; consequently, two prime numbers are relatively prime:
The LCM for prime numbers is their product:
MersennePrimeExponents are prime numbers:
Use FactorInteger to find all prime divisors of a number:
PrimeOmega returns 1 for prime numbers:
PrimePi gives the number of primes:
PrimeNu counts the number of prime divisors of a number:
Simplify expressions containing prime numbers:
Solve over Primes: