PrimeQ
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.
Examples
open allclose allScope (4)
Applications (22)
Basic Applications (5)
Special Sequences (11)
Eisenstein integers are complex numbers of the form where a and b are integers and ω is the cube root of unity :
Check wether an Eisenstein integer is prime:
The quadratic polynomial is prime for :
Recognize Fermat primes, prime numbers of the form :
The number is not a Fermat prime:
Recognize Carmichael numbers, composite numbers n that satisfy mod for all integers b that are relatively prime to n:
The number 1729 is a Carmichael number; 1310 is not:
Recognize Wieferich primes, prime numbers p such that divides :
There are only two known Wieferich primes:
Recognize Gaussian Mersenne primes, prime numbers n such that is a Gaussian prime:
Let be all numbers of the form :
Check that the product of two numbers is still in :
Recognize Hilbert primes, prime numbers that have no divisors in other than 1 and itself:
Find the first 10 Hilbert primes:
Test whether or not the first 47 Mersenne prime exponents are prime:
Number Theory (6)
Find numbers that are prime over Gaussian integers and integers:
They are congruent to 3 mod 4:
These numbers cannot be written as the sum of two squares:
Find numbers that are composite over Gaussian integers but prime over integers:
All of them except for 2 are congruent to 1 mod 4:
These numbers can be written as the sum of two squares in 8 ways:
Plot the difference between two consecutive primes:
The infinite sum of reciprocals of prime powers that are not prime converges:
The distribution of primes over integers:
Properties & Relations (22)
Primes represents the domain of all prime numbers:
Prime gives prime number:
RandomPrime generates random prime numbers:
PrimePowerQ gives True for all prime numbers:
Primes that are congruent to 1 mod 4 are not prime powers in the Gaussian integers:
Prime powers are divisible by exactly one prime number:
The only divisors of a prime number p is 1 and p:
The only even prime number is 2:
PrimeQ gives False for all composite numbers:
CompositeQ gives False for all primes:
Every integer greater than 1 either is a prime number itself or can be represented as the product of 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:
The sum of the prime divisors of a prime number returns the original number:
Prime numbers of the form , where the exponent p is also prime, are called Mersenne primes:
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:
The number of prime numbers up to 1000:
PrimeNu counts the number of prime divisors of a number:
Simplify expressions containing prime numbers:
Solve over Primes:
Text
Wolfram Research (1988), PrimeQ, Wolfram Language function, https://reference.wolfram.com/language/ref/PrimeQ.html (updated 2003).
CMS
Wolfram Language. 1988. "PrimeQ." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2003. https://reference.wolfram.com/language/ref/PrimeQ.html.
APA
Wolfram Language. (1988). PrimeQ. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/PrimeQ.html