All Topics  
Prime number

 

   Email Print
   Bookmark   Link






 

Prime number



 
 
In mathematics
Mathematics

Mathematics is the study of quantity, structure, space, change, and related topics of pattern and form. Mathematicians seek out patterns whether found in numbers, space, natural science, computers, imaginary abstractions, or elsewhere....
, a prime number (or a prime) is a natural number
Natural number

In mathematics, a natural number can mean either an element of the Set = *n = = ? = ? ...
 which has exactly two distinct natural number divisor
Divisor

In mathematics, a divisor of an integer n, also called a factor of n, is an integer which evenly divides n without leaving a remainder....
s: 1
1 (number)

1 is a number, number names, and the name of the glyph representing that number.It represents a single entity, the unit of counting or measurement....
 and itself. An infinitude of prime numbers exists, as demonstrated by Euclid
Euclid

Euclid , floruit 300 BC, also known as Euclid of Alexandria, was a Greek mathematics and is often referred to as the Father of Geometry. He was active in Alexandria during the reign of Ptolemy I ....
 around 300 BC. The first twenty-five prime numbers are:
2
2 (number)

2 is a number, numeral, and glyph. It is the natural number following 1 and preceding 3 ....
, 3
3 (number)

----3 is a number, Numeral system, and glyph. It is the natural number following 2 and preceding 4 ....
, 5
5 (number)

5 is a number, numeral, and glyph. It is the natural number following 4 and preceding 6 ....
, 7
7 (number)

7 is the natural number following 6 and preceding 8 . It is the smallest positive integer to be spoken with two syllables when pronounced in English....
, 11
11 (number)

11 is the natural number following 10 and preceding 12 . It is the first number which cannot be represented by a human counting his or her eight fingers and two thumbs additively ....
, 13
13 (number)

13 is the natural number after 12 and before 14 . It is the smallest integer with eight letters in its spelled out name in English. It is also the age at which children become teenagers....
, 17
17 (number)

17 is the natural number following 16 and preceding 18 ....
, 19
19 (number)

19 is the natural number following 18 and preceding 20 . It is a prime number....
, 23
23 (number)

23 is the natural number following 22 and preceding 24 ....
, 29
29 (number)

29 is the natural number following 28 and preceding 30 ....
, 31
31 (number)

31 is the natural number following thirty and preceding thirty-two....
, 37
37 (number)

37 is the natural number following 36 and preceding 38 ....
, 41
41 (number)

41 is the natural number following 40 and preceding 42 ....
, 43
43 (number)

43 is the natural number following 42 and preceding 44 ....
, 47
47 (number)

47 is the natural number following 46 and preceding 48 ....
, 53
53 (number)

53 is the natural number following 52 and preceding 54 ....
, 59
59 (number)

59 is the natural number following 58 and preceding 60 ....
, 61
61 (number)

61 is the natural number following 60 and preceding 62 ....
, 67
67 (number)

67 is the natural number following 66 and preceding 68 . It is an Parity ...
, 71
71 (number)

71 is the natural number following 70 and preceding 72 ....
, 73
73 (number)

73 is the natural number following 72 and preceding 74 . In English, it is the smallest integer with twelve letters in its spelled out name....
, 79
79 (number)

79 is the natural number following 78 and preceding 80 ....
, 83
83 (number)

83 is the natural number following 82 and preceding 84 ....
, 89
89 (number)

89 is the natural number following 88 and preceding 90 ....
, 97
97 (number)

97 is the natural number following 96 and preceding 98 ....
 .
See the list of prime numbers
List of prime numbers

There are infinitely many prime numbers. Prime numbers may be generated with various formulas for primes. The first 500 are listed below, followed by lists of the first prime numbers of various types in alphabetical order....
 for a longer list. The number 1 is by definition not a prime number.






Discussion
Ask a question about 'Prime number'
Start a new discussion about 'Prime number'
Answer questions from other users
Full Discussion Forum



Recent Posts









Encyclopedia


In mathematics
Mathematics

Mathematics is the study of quantity, structure, space, change, and related topics of pattern and form. Mathematicians seek out patterns whether found in numbers, space, natural science, computers, imaginary abstractions, or elsewhere....
, a prime number (or a prime) is a natural number
Natural number

In mathematics, a natural number can mean either an element of the Set = *n = = ? = ? ...
 which has exactly two distinct natural number divisor
Divisor

In mathematics, a divisor of an integer n, also called a factor of n, is an integer which evenly divides n without leaving a remainder....
s: 1
1 (number)

1 is a number, number names, and the name of the glyph representing that number.It represents a single entity, the unit of counting or measurement....
 and itself. An infinitude of prime numbers exists, as demonstrated by Euclid
Euclid

Euclid , floruit 300 BC, also known as Euclid of Alexandria, was a Greek mathematics and is often referred to as the Father of Geometry. He was active in Alexandria during the reign of Ptolemy I ....
 around 300 BC. The first twenty-five prime numbers are:
2
2 (number)

2 is a number, numeral, and glyph. It is the natural number following 1 and preceding 3 ....
, 3
3 (number)

----3 is a number, Numeral system, and glyph. It is the natural number following 2 and preceding 4 ....
, 5
5 (number)

5 is a number, numeral, and glyph. It is the natural number following 4 and preceding 6 ....
, 7
7 (number)

7 is the natural number following 6 and preceding 8 . It is the smallest positive integer to be spoken with two syllables when pronounced in English....
, 11
11 (number)

11 is the natural number following 10 and preceding 12 . It is the first number which cannot be represented by a human counting his or her eight fingers and two thumbs additively ....
, 13
13 (number)

13 is the natural number after 12 and before 14 . It is the smallest integer with eight letters in its spelled out name in English. It is also the age at which children become teenagers....
, 17
17 (number)

17 is the natural number following 16 and preceding 18 ....
, 19
19 (number)

19 is the natural number following 18 and preceding 20 . It is a prime number....
, 23
23 (number)

23 is the natural number following 22 and preceding 24 ....
, 29
29 (number)

29 is the natural number following 28 and preceding 30 ....
, 31
31 (number)

31 is the natural number following thirty and preceding thirty-two....
, 37
37 (number)

37 is the natural number following 36 and preceding 38 ....
, 41
41 (number)

41 is the natural number following 40 and preceding 42 ....
, 43
43 (number)

43 is the natural number following 42 and preceding 44 ....
, 47
47 (number)

47 is the natural number following 46 and preceding 48 ....
, 53
53 (number)

53 is the natural number following 52 and preceding 54 ....
, 59
59 (number)

59 is the natural number following 58 and preceding 60 ....
, 61
61 (number)

61 is the natural number following 60 and preceding 62 ....
, 67
67 (number)

67 is the natural number following 66 and preceding 68 . It is an Parity ...
, 71
71 (number)

71 is the natural number following 70 and preceding 72 ....
, 73
73 (number)

73 is the natural number following 72 and preceding 74 . In English, it is the smallest integer with twelve letters in its spelled out name....
, 79
79 (number)

79 is the natural number following 78 and preceding 80 ....
, 83
83 (number)

83 is the natural number following 82 and preceding 84 ....
, 89
89 (number)

89 is the natural number following 88 and preceding 90 ....
, 97
97 (number)

97 is the natural number following 96 and preceding 98 ....
 .
See the list of prime numbers
List of prime numbers

There are infinitely many prime numbers. Prime numbers may be generated with various formulas for primes. The first 500 are listed below, followed by lists of the first prime numbers of various types in alphabetical order....
 for a longer list. The number 1 is by definition not a prime number. The set of prime numbers is sometimes denoted by .

The property of being a prime is called primality, and the word prime is also used as an adjective. Since 2 is the only even prime number, the term odd prime refers to any prime number greater than 2.

The study of prime numbers is part of number theory
Number theory

Number theory is the branch of pure mathematics concerned with the properties of numbers in general, and integers in particular, as well as the wider classes of problems that arise from their study....
, the branch of mathematics which encompasses the study of natural numbers. Prime numbers have been the subject of intense research, yet some fundamental questions, such as the Riemann hypothesis
Riemann hypothesis

In mathematics, the Riemann hypothesis, due to , is a conjecture about the distribution of the Root of the Riemann zeta function stating that all non-trivial zeros of the Riemann zeta function have real part 1/2....
 and the Goldbach conjecture
Goldbach's conjecture

Goldbach's conjecture is one of the oldest unsolved problems in mathematicss in number theory and in all of mathematics. It states:Expressing a given even number as a sum of two primes is called a Goldbach Partition of the number....
, have been unresolved for more than a century. The problem of modelling the distribution of prime numbers is a popular subject of investigation for number theorists: when looking at individual numbers, the primes seem to be randomly distributed, but the “global” distribution of primes follows well-defined laws.

The notion of prime number has been generalized in many different branches of mathematics:
  • In ring theory
    Ring theory

    In mathematics, ring theory is the study of ring , algebraic structures in which addition and multiplication are defined and have similar properties to those familiar from the integers....
    , a branch of abstract algebra
    Abstract algebra

    Abstract algebra is the subject area of mathematics that studies algebraic structures, such as group , ring , field , module , vector spaces, and algebra over a field....
    , the term “prime element” has a specific meaning. Here, a non-zero, non-unit ring element a is defined to be prime if whenever a divides bc for ring elements b and c, then a divides at least one of b or c. With this meaning, the additive inverse of any prime number is also prime. In other words, when considering the set of integer
    Integer

    The integers are natural numbers including 0 and their negative and non-negative numberss . They are numbers that can be written without a fractional or decimal component, and fall within the set ....
    s as a ring
    Ring (mathematics)

    In mathematics, a ring is a type of algebraic structure. There is some variation among mathematicians as to exactly what properties a ring is required to have, as described in detail below....
    , −7 is a prime element. Without further specification, however, “prime number” always means a positive integer prime. Among rings of complex
    Complex number

    In mathematics, the complex numbers are an extension of the real numbers obtained by adjoining an imaginary unit, denoted i, which satisfies:...
     algebraic integer
    Algebraic integer

    This article deals with the ring of complex numbers integral over Z. For the general notion of algebraic integer, see Integrality.In number theory, an algebraic integer is a complex number that is a root of some monic polynomial with integer coefficients....
    s, Eisenstein prime
    Eisenstein prime

    In mathematics, an Eisenstein prime is an Eisenstein integerthat is irreducible element in the ring-theoretic sense: its only Eisenstein divisors are the unit s , a + bω itself and its associates....
    s and Gaussian primes may also be of interest.
  • In knot theory
    Knot theory

    In mathematics, knot theory is the area of topology that studies knot s. While inspired by knots which appear in daily life in shoelaces and rope, a mathematician's knot differs drastically in that the ends are joined together to prevent it from becoming undone....
    , a prime knot
    Prime knot

    In knot theory, a prime knot is a knot that is, in a certain sense, indecomposable. Specifically, it is a non-unknot knot which cannot be written as the knot sum of two non-trivial knots....
     is a knot
    Knot (mathematics)

    In mathematics, a knot is an embedding of a circle in 3-dimensional Euclidean space, R3, considered up to continuous deformations ....
     which can not be written as the knot sum of two lesser nontrivial knots.


History

There are hints in the surviving records of the ancient Egypt
Ancient Egypt

Ancient Egypt was an Ancient history civilization in eastern North Africa, concentrated along the lower reaches of the Nile in what is now the modern nation of Egypt....
ians that they had some knowledge of prime numbers: the Egyptian fraction
Egyptian fraction

An Egyptian fraction is the sum of distinct unit fractions, such as . That is, each Fraction in the expression has a numerator equal to 1 and a denominator that is a positive integer, and all the denominators differ from each other....
 expansions in the Rhind papyrus, for instance, have quite different forms for primes and for composites. However, the earliest surviving records of the explicit study of prime numbers come from the Ancient Greeks
Ancient Greece

The term Ancient Greece refers to the period of History of Greece lasting from the Greek Dark Ages ca. 1100 BC and the Dorian invasion, to 146 BC and the Roman Republic conquest of Greece after the Battle of Corinth ....
. Euclid's Elements
Euclid's Elements

Euclid's Elements is a mathematics and geometry treatise consisting of 13 books written by the Greek mathematics Euclid in Alexandria circa 300 BC....
 (circa 300 BC) contain important theorems about primes, including the infinitude of primes and the fundamental theorem of arithmetic
Fundamental theorem of arithmetic

In number theory and algebraic number theory, the Fundamental Theorem of Arithmetic states that any integer greater than 1 can be written as a unique product of prime numbers....
. Euclid also showed how to construct a perfect number
Perfect number

In mathematics, a perfect number is defined as a Negative and non-negative numbers which is the sum of its proper positive divisors, that is, the sum of the positive divisors excluding the number itself....
 from a Mersenne prime
Mersenne prime

In mathematics, a Mersenne number is a positive integer that is one less than a power of two:Some definitions of Mersenne numbers require that the exponent n be prime....
. The Sieve of Eratosthenes
Sieve of Eratosthenes

In mathematics, the Sieve of Eratosthenes is a simple, ancient algorithm for finding all prime numbers up to a specified integer.It works efficiently for the smaller primes ....
, attributed to Eratosthenes
Eratosthenes

Eratosthenes of Cyrene was a Greeks mathematician, poet, sportsperson, geographer and astronomer. He made several discoveries and inventions including a system of latitude and longitude....
, is a simple method to compute primes, although the large primes found today with computers are not generated this way.

After the Greeks, little happened with the study of prime numbers until the 17th century. In 1640 Pierre de Fermat
Pierre de Fermat

Pierre de Fermat was a France lawyer at the Parlement of Toulouse, France, and a mathematician who is given credit for early developments that led to modern calculus....
 stated (without proof) Fermat's little theorem
Fermat's little theorem

Fermat's little theorem states that if is a prime number, then for any integer , will be evenly divisible by . This can be expressed in the notation of modular arithmetic as follows:...
 (later proved by Leibniz and Euler
Leonhard Euler

Leonhard Paul Euler was a pioneering Swiss mathematician and physicist who spent most of his life in Russia and Germany.Euler made important discoveries in fields as diverse as calculus and graph theory....
). A special case of Fermat's theorem may have been known much earlier by the Chinese. Fermat conjectured that all numbers of the form 22n + 1 are prime (they are called Fermat number
Fermat number

In mathematics, a Fermat number, named after Pierre de Fermat who first studied them, is a natural number of the formwhere n is a nonnegative integer....
s) and he verified this up to n = 4 (or 216 + 1). However, the very next Fermat number 232 + 1 is composite (one of its prime factors is 641), as Euler discovered later, and in fact no further Fermat numbers are known to be prime. The French monk Marin Mersenne
Marin Mersenne

Marin Mersenne, Marin Mersennus or le P?re Mersenne was a France theology, philosopher, mathematician and Music theory, often referred to as the "father of acoustics" ....
 looked at primes of the form 2p − 1, with p a prime. They are called Mersenne prime
Mersenne prime

In mathematics, a Mersenne number is a positive integer that is one less than a power of two:Some definitions of Mersenne numbers require that the exponent n be prime....
s in his honor.

Euler's work in number theory included many results about primes. He showed the infinite series 1/2 + 1/3 + 1/5 + 1/7 + 1/11 + …
Proof that the sum of the reciprocals of the primes diverges

In the third century BC, Euclid proved the existence of infinitely many prime numbers. In the 18th century, Leonhard Euler proved a stronger statement: the sum of the multiplicative inverses of all prime numbers diverges, meaning that...
 is divergent. In 1747 he showed that the even perfect numbers are precisely the integers of the form 2p−1(2p − 1), where the second factor is a Mersenne prime. It is believed no odd perfect numbers exist, but there is still no proof.

At the start of the 19th century, Legendre and Gauss independently conjectured that as x tends to infinity, the number of primes up to x is asymptotic to x/log(x), where log(x) is the natural logarithm of x. Ideas of Riemann in his 1859 paper on the zeta-function sketched a program which would lead to a proof of the prime number theorem. This outline was completed by Hadamard
Jacques Hadamard

Jacques Salomon Hadamard was a France mathematician best known for his proof of the prime number theorem in 1896....
 and de la Vallée Poussin, who independently proved the prime number theorem in 1896.

Proving a number is prime is not done (for large numbers) by trial division. Many mathematicians have worked on primality test
Primality test

A primality test is an algorithm for determining whether an input number is prime number. Amongst other fields of mathematics, it is used for cryptography....
s for large numbers, often restricted to specific number forms. This includes Pépin's test
Pépin's test

In mathematics, P?pin's test is a primality test, which can be used to determine whether a Fermat number is prime number. It is a variant of Proth's theorem....
 for Fermat numbers (1877), Proth's theorem
Proth's theorem

In number theory, Proth's theorem is a primality test for Proth numbers.It states that if p is a Proth number, of the form k2n + 1 with k odd and k n, then if for some integer a,...
 (around 1878), the Lucas–Lehmer test for Mersenne numbers
Lucas–Lehmer test for Mersenne numbers

In mathematics, the Lucas?Lehmer test is a primality test for Mersenne primes. The test was originally developed by Edouard Lucas in 1856 , and subsequently improved by Lucas in 1878 and Derrick Henry Lehmer in the 1930s....
 (originated 1856), and the generalized Lucas–Lehmer test
Lucas–Lehmer test

In computational number theory, the Lucas?Lehmer test is a primality test for a natural number n; it requires that the prime number#Prime divisors of n − 1 be already known....
. More recent algorithms like APRT-CL, ECPP
Elliptic curve primality proving

Elliptic Curve Primality Proving is a method based on elliptic curves to prove the prime number of a number. It is a general-purpose algorithm, meaning it does not depend on the number being a special form....
 and AKS
AKS primality test

The AKS primality test is a deterministic algorithm primality test algorithm created and published by three Indian Institute of Technology Kanpur computer scientists, Manindra Agrawal, Neeraj Kayal, and Nitin Saxena on August 6, 2002 in a paper titled PRIMES is in P....
 work on arbitrary numbers but remain much slower.

For a long time, prime numbers were thought to have extremely limited application outside of pure mathematics
Pure mathematics

Broadly speaking, pure mathematics is mathematics motivated entirely for reasons other than application. It is distinguished by its Rigour#Mathematical_rigour, abstraction and mathematical beauty....
; this changed in the 1970s when the concepts of public-key cryptography
Public-key cryptography

Public-key cryptography is a method for secret communication between two parties without requiring an initial key exchange of secret key. It can also be used to create digital signature....
 were invented, in which prime numbers formed the basis of the first algorithms such as the RSA
RSA

In cryptography, RSA is an algorithm for public-key cryptography. It is the first algorithm known to be suitable for digital signature as well as encryption, and one of the first great advances in public key cryptography....
 cryptosystem algorithm.

Since 1951 all the largest known prime
Largest known prime

The largest known prime number is the largest integer that is currently known to be a prime number.It was proven by Euclid that there are infinitely many prime numbers; thus, there is always a prime greater than the largest known prime....
s have been found by computer
Computer

A computer is a machine that manipulates Data according to a list of Code .The first devices that resemble modern computers date to the mid-20th century , although the computer concept and various machines similar to computers existed earlier....
s. The search for ever larger primes has generated interest outside mathematical circles. The Great Internet Mersenne Prime Search
Great Internet Mersenne Prime Search

The Great Internet Mersenne Prime Search is a collaborative project of volunteers who use Prime95 and MPrime computer software that can be downloaded from the Internet for free in order to search for Mersenne prime....
 and other distributed computing
Distributed computing

Distributed computing deals with hardware and software systems containing more than one processing element or Computer data storage element, Concurrent computing processes, or multiple programs, running under a loosely or tightly controlled regime....
 projects to find large primes have become popular in the last ten to fifteen years, while mathematicians continue to struggle with the theory of primes.

Primality of one


Until the 19th century, most mathematicians considered the number 1 a prime, with the definition being just that a prime is divisible only by 1 and itself but not requiring a specific number of distinct divisors. There is still a large body of mathematical work that is valid despite labelling 1 a prime, such as the work of Stern
Moritz Abraham Stern

Moritz Abraham Stern was a German mathematician. Stern became Ordinarius at G?ttingen University in 1858, succeeding Carl Friedrich Gauss....
 and Zeisel. Derrick Norman Lehmer
Derrick Norman Lehmer

Derrick Norman Lehmer was an United States mathematician and number theorist.He was educated at the University of Nebraska, obtaining a bachelor's degree in 1893 and master's in 1896....
's list of primes up to 10,006,721, reprinted as late as 1956, started with 1 as its first prime. Henri Lebesgue
Henri Lebesgue

Henri L?on Lebesgue was a France mathematician, most famous for his theory of integral. Lebesgue's integration theory was originally published in his dissertation, A summary of Henri Lebesgue's dissertation , at the University of Nancy in 1902....
 is said to be the last professional mathematician to call 1 prime. The change in label occurred so that the fundamental theorem of arithmetic
Fundamental theorem of arithmetic

In number theory and algebraic number theory, the Fundamental Theorem of Arithmetic states that any integer greater than 1 can be written as a unique product of prime numbers....
, as stated, is valid, i.e., “each number has a unique factorization into primes.” Furthermore, the prime numbers have several properties that the number 1 lacks, such as the relationship of the number to its corresponding value of Euler's totient function
Euler's totient function

In number theory, the totient of a positive integer n is defined to be the number of positive integers less than or equal to n that are coprime to n....
 or the sum of divisors function.

Prime divisors


The fundamental theorem of arithmetic
Fundamental theorem of arithmetic

In number theory and algebraic number theory, the Fundamental Theorem of Arithmetic states that any integer greater than 1 can be written as a unique product of prime numbers....
 states that every positive integer larger than 1 can be written as a product of one or more primes in a way which is unique except possibly for the order of the prime factors
Divisor

In mathematics, a divisor of an integer n, also called a factor of n, is an integer which evenly divides n without leaving a remainder....
. The same prime factor may occur multiple times. Primes can thus be considered the “basic building blocks” of the natural numbers. For example, we can write



and any other factorization of 23244 as the product of primes will be identical except for the order of the factors. There are many prime factorization
Integer factorization

In number theory, integer factorization is the breaking down of a composite number into smaller non-trivial divisors, which when multiplied together equal the original integer....
 algorithms to do this in practice for larger numbers.

The importance of this theorem is one of the reasons for the exclusion of 1 from the set of prime numbers. If 1 were admitted as a prime, the precise statement of the theorem would require additional qualifications.

Properties

  • When written in base 10, all prime numbers except 2 and 5 end in 1, 3, 7 or 9. (Numbers ending in 0, 2, 4, 6 or 8 represent multiples of 2 and numbers ending in 0 or 5 represent multiples of 5.)
  • If p is a prime number and p divides a product ab of integers, then p divides a or p divides b. This proposition was proved by Euclid and is known as Euclid's lemma
    Euclid's lemma

    Euclid's lemma is a generalization of Proposition 30 of Book VII of Euclid's Elements. The lemma states thatThis can be written in notation:...
    . It is used in some proofs of the uniqueness of prime factorizations.
  • The ring Z/nZ (see modular arithmetic
    Modular arithmetic

    In mathematics, modular arithmetic is a system of arithmetic for integers, where numbers "wrap around" after they reach a certain value — the modulus....
    ) is a field
    Field (mathematics)

    In abstract algebra, a field is an algebraic structure with notions of addition, subtraction, multiplication and division , satisfying certain axioms....
     if and only if
    If and only if

    If and only if, in logic and fields that rely on it such as mathematics and philosophy, is a biconditional logical connective between statements....
     
    n is a prime. Put another way: n is prime if and only if f(n)
    Euler's totient function

    In number theory, the totient of a positive integer n is defined to be the number of positive integers less than or equal to n that are coprime to n....
     =
    n − 1.
  • If p is prime and a is any integer, then ap − a is divisible by p (Fermat's little theorem
    Fermat's little theorem

    Fermat's little theorem states that if is a prime number, then for any integer , will be evenly divisible by . This can be expressed in the notation of modular arithmetic as follows:...
    ).
  • If p is a prime number other than 2 and 5, 1/p is always a recurring decimal, whose period is p − 1 or a divisor of p − 1. This can be deduced directly from Fermat's little theorem
    Fermat's little theorem

    Fermat's little theorem states that if is a prime number, then for any integer , will be evenly divisible by . This can be expressed in the notation of modular arithmetic as follows:...
    . 1/
    p expressed likewise in base q (rather than base 10) has similar effect, provided that p is not a prime factor of q. The article on recurring decimals shows some of the interesting properties.
  • An integer p > 1 is prime if and only if the factorial
    Factorial

    In mathematics, the factorial of a negative and non-negative numbers integer n, denoted by n!, is the Product of all positive integers less than or equal to n....
     (
    p − 1)! + 1 is divisible by p (Wilson's theorem
    Wilson's theorem

    In mathematics, Wilson's theorem states that p > 1 is a prime number if and only if....
    ). Conversely, an integer
    n > 4 is composite if and only if (n − 1)! is divisible by n.
  • If n is a positive integer greater than 1, then there is always a prime number p with n < p < 2n (Bertrand's postulate
    Bertrand's postulate

    Bertrand's postulate states that if n > 3 is an integer, then there always exists at least one prime number p with n < p < 2n − 2....
    ).
  • Adding the reciprocals of all primes together results in a divergent infinite series (proof
    Proof that the sum of the reciprocals of the primes diverges

    In the third century BC, Euclid proved the existence of infinitely many prime numbers. In the 18th century, Leonhard Euler proved a stronger statement: the sum of the multiplicative inverses of all prime numbers diverges, meaning that...
    ). More precisely, if
    S(x) denotes the sum of the reciprocals of all prime numbers p with p = x, then S(x) = ln ln x + O
    Big O notation

    In mathematics, big O notation describes the asymptotic analysis of a function when the argument tends towards a particular value or infinity, usually in terms of simpler functions....
    (1) for
    x ? 8.
  • In every arithmetic progression a, a + q, a + 2q, a + 3q, … where the positive integers a and q are coprime
    Coprime

    In mathematics, the integers a and b are said to be coprime or relatively prime if they have no common divisor other than 1 or, equivalently, if their greatest common divisor is 1....
    , there are infinitely many primes (Dirichlet's theorem on arithmetic progressions
    Dirichlet's theorem on arithmetic progressions

    In number theory, Dirichlet's theorem, also called the Dirichlet prime number theorem, states that for any two positive coprime integers a and d, there are infinitely many prime number of the form a + nd, where n = 0, or in other words: there are infinitely many primes which are congruence relation to a modular arithme...
    ).
  • The characteristic
    Characteristic (algebra)

    In mathematics, the characteristic of a ring R, often denoted char, is defined to be the smallest number of times one must add the ring's multiplicative identity element to itself to get the additive identity element ; the ring is said to have characteristic zero if this repeated sum never reaches the additive identity....
     of every field is either zero or a prime number.
  • If G is a finite group
    Group (mathematics)

    In mathematics, a group is an algebraic structure consisting of a set together with an Binary operation that combines any two of its element to form a third element....
     and
    pn is the highest power of the prime p which divides
    P-adic order

    In number theory, for a given prime number p, the p-adic order or additive p-adic valuation of a number n is the highest exponent ? such that p? divides n....
     the order of
    G, then G has a subgroup of order pn. (Sylow theorems.)
  • If G is a finite group and p is a prime number dividing the order of G, then G contains an element of order p. (Cauchy Theorem
    Cauchy's theorem (group theory)

    Cauchy's theorem is a theorem in the mathematics of group theory, named after Augustin Louis Cauchy. It states that if G is a finite group and p is a prime number dividing the Order of G , then G contains an element of order p....
    )
  • The prime number theorem
    Prime number theorem

    In number theory, the prime number theorem describes the asymptotic analysis distribution of the prime numbers. The prime number theorem gives a rough description of how the primes are distributed....
     says that the proportion of primes less than
    x is asymptotic to 1/ln x (in other words, as x gets very large, the likelihood that a number less than x is prime is inversely proportional to the number of digits in x).
  • The Copeland-Erdos constant
    Copeland-Erdos constant

    The Copeland?Erdos constant is the concatenation of "0." with the base 10 representations of the prime numbers in order. Its value is approximately...
     0.235711131719232931374143…, obtained by concatenating the prime numbers in base ten
    Decimal

    The decimal numeral system has 10 as its Base . It is the most widely used numeral system....
    , is known to be an irrational number
    Irrational number

    In mathematics, an irrational number is any real number that is not a rational number ? that is, it is a number which cannot be expressed as a fraction m/n, where m and n are integers, with n non-zero....
    .
  • The value of the Riemann zeta function
    Riemann zeta function

    In mathematics, the Riemann zeta function, named after Germany mathematician Bernhard Riemann, is a prominent function of great significance in number theory because of its relation to the prime number theorem....
     at each point in the complex plane is given as a meromorphic continuation of a function, defined by a product over the set of all primes for Re(
    s) > 1:
Evaluating this identity at different integers provides an infinite number of products over the primes whose values can be calculated, the first two being
  • If p > 1, the polynomial is irreducible over Z/pZ if and only if p is prime.
  • An integer n is prime if and only if the Chebyshev polynomial of the first kind , divided by is irreducible in . Also if and only if is prime.
  • All prime numbers above 3 are of the form 6n - 1 or 6n + 1, because all other numbers are divisible by 2 or 3. Generalizing this, all prime numbers above q are of form q#
    Primorial

    The name primorial is attributed to Harvey Dubner and is a portmanteau of prime number and factorial. There are two definitions for primorial: one for prime numbers and one for natural numbers....
    ·n + m, where 0 < m < q, and m has no prime factor = q.


Classification

Two ways of classifying prime numbers, class n+ and class n−, were studied by Paul Erdos
Paul Erdos

Paul Erdos was an immensely prolific and famously eccentric Hungary mathematician. With hundreds of collaborators, he worked on problems in combinatorics, graph theory, number theory, classical analysis, approximation theory, set theory, and probability theory....
 and John Selfridge
John Selfridge

John L. Selfridge is an USA mathematician who has contributed to the field of analytic number theory. He co-authored 14 papers with Paul Erdos ....
.

Determining the class n+ of a prime number p involves looking at the largest prime factor of p + 1. If that largest prime factor is 2 or 3, then p is class 1+. But if that largest prime factor is another prime q, then the class n+ of p is one more than the class n+ of q. Sequences through list class 1+ through class 4+ primes.

The class n− is almost the same as class n+, except that the factorization of p − 1 is looked at instead.

The number of prime numbers


There are infinitely many prime numbers

The oldest known proof for the statement that there are infinitely many prime numbers is given by the Greek mathematician Euclid
Euclid

Euclid , floruit 300 BC, also known as Euclid of Alexandria, was a Greek mathematics and is often referred to as the Father of Geometry. He was active in Alexandria during the reign of Ptolemy I ....
 in his Elements (Book IX, Proposition 20). Euclid states the result as "there are more than any given [finite] number of primes", and his proof is essentially the following:

Consider any finite set of primes. Multiply all of them together and add 1 (see Euclid number
Euclid number

In mathematics, Euclid numbers are integers of the form E'n = p'n# + 1, where p'n# is the primorial of p'n which is the nth prime....
). The resulting number is not divisible by any of the primes in the finite set we considered, because dividing by any of these would give a remainder of 1. Because all non-prime numbers can be decomposed into a product of underlying primes, then either this resultant number is prime itself, or there is a prime number or prime numbers which the resultant number could be decomposed into but are not in the original finite set of primes. Either way, there is at least one more prime that was not in the finite set we started with. This argument applies no matter what finite set we began with. So there are more primes than any given finite number.


This previous argument explains why the product P of finitely many primes plus 1 must be divisible by some prime (possibly itself) not among those finitely many primes.

The proof is sometimes phrased in a way that falsely leads some readers to think that P + 1 must itself be prime, and think that Euclid's proof says the prime product plus 1 is always prime. This confusion arises when the proof is presented as a proof by contradiction and P is assumed to be the product of the members of a finite set containing all primes. Then it is asserted that if P + 1 is not divisible by any members of that set, then it is not divisible by any primes and "is therefore itself prime" (quoting G. H. Hardy
G. H. Hardy

G. H. Hardy Fellow of the Royal Society was a prominent England mathematics, known for his achievements in number theory and mathematical analysis....
). This sometimes leads readers to conclude mistakenly that if P is the product of the first n primes
Primorial

The name primorial is attributed to Harvey Dubner and is a portmanteau of prime number and factorial. There are two definitions for primorial: one for prime numbers and one for natural numbers....
 then P + 1 is prime. That conclusion relies on a hypothesis later proved false, and so cannot be considered proved. The smallest counterexample with composite P + 1 is (2 × 3 × 5 × 7 × 11 × 13) + 1 = 30,031 = 59 × 509 (both primes). See also Euclid's theorem
Euclid's theorem

Euclid's theorem is a fundamental statement in number theory which asserts that there are Infinite set many prime numbers. There are several well-known proofs of the theorem....
.

Other mathematicians have given other proofs. One of these (due to Euler
Leonhard Euler

Leonhard Paul Euler was a pioneering Swiss mathematician and physicist who spent most of his life in Russia and Germany.Euler made important discoveries in fields as diverse as calculus and graph theory....
) shows that the sum of the reciprocals of all prime numbers diverges
Proof that the sum of the reciprocals of the primes diverges

In the third century BC, Euclid proved the existence of infinitely many prime numbers. In the 18th century, Leonhard Euler proved a stronger statement: the sum of the multiplicative inverses of all prime numbers diverges, meaning that...
. Another proof
Fermat number

In mathematics, a Fermat number, named after Pierre de Fermat who first studied them, is a natural number of the formwhere n is a nonnegative integer....
 based on Fermat number
Fermat number

In mathematics, a Fermat number, named after Pierre de Fermat who first studied them, is a natural number of the formwhere n is a nonnegative integer....
s was given by Goldbach
Christian Goldbach

Christian Goldbach was a Prussian mathematician who also studied law. He is remembered today for Goldbach's conjecture....
. Kummer
Ernst Kummer

Ernst Eduard Kummer was a Germany mathematician. Highly skilled in applied mathematics, Kummer trained German army officers in ballistics; afterwards, he taught for 10 years in a Gymnasium , where he inspired the mathematical career of Leopold Kronecker....
's is particularly elegant and Harry Furstenberg provides one using general topology
Furstenberg's proof of the infinitude of primes

In number theory, Hillel Furstenberg's proof of the infinitude of primes is a celebrated topology Mathematical proof that the integers contain Infinite set many prime numbers....
.

Counting the number of prime numbers below a given number

Even though the total number of primes is infinite, one could still ask "Approximately how many primes are there below 100,000?", or "How likely is a random 20-digit number to be prime?".

The prime-counting function p(x) is defined as the number of primes up to x. There are known algorithm
Algorithm

In mathematics, computing, linguistics and related subjects, an algorithm is a sequence of finite instructions, often used for calculation and data processing....
s to compute exact values of p(x) faster than it would be possible to compute each prime up to x. Values as large as p(1020) can be calculated quickly and accurately with modern computers. Thus, e.g., p(100,000) = 9592, and p(1020) = 2,220,819,602,560,918,840.

For larger values of x, beyond the reach of modern equipment, the prime number theorem
Prime number theorem

In number theory, the prime number theorem describes the asymptotic analysis distribution of the prime numbers. The prime number theorem gives a rough description of how the primes are distributed....
 provides a good estimate: p(x) is approximately x/ln(x). Even better estimates are known; see for example Prime number theorem#The prime-counting function in terms of the logarithmic integral
Prime number theorem

In number theory, the prime number theorem describes the asymptotic analysis distribution of the prime numbers. The prime number theorem gives a rough description of how the primes are distributed....
.

Location of prime numbers


Finding prime numbers


The ancient sieve of Eratosthenes
Sieve of Eratosthenes

In mathematics, the Sieve of Eratosthenes is a simple, ancient algorithm for finding all prime numbers up to a specified integer.It works efficiently for the smaller primes ....
 is a simple way to compute all prime numbers up to a given limit, by making a list of all integers and repeatedly striking out multiples of already found primes. The modern sieve of Atkin
Sieve of Atkin

In mathematics, the sieve of Atkin is a fast, modern algorithm for finding all prime numbers up to a specified integer. It is an optimized version of the ancient sieve of Eratosthenes, but does some preliminary work and then marks off multiples of primes squared, rather than multiples of primes....
 is more complicated, but faster when properly optimized.

In practice one often wants to check whether a given number is prime, rather than generate a list of primes. Further, it is often satisfactory to know the answer with a high probability
Probability

Probability, or wikt:chance, is a way of expressing knowledge or belief that an Event will occur or has occurred. In mathematics the concept has been given an exact meaning in probability theory, that is used extensively in such areas of study as mathematics, statistics, finance, gambling, science, and philosophy to draw conclusions about t...
. It is possible to quickly check whether a given large number (say, up to a few thousand digits) is prime using probabilistic primality test
Primality test

A primality test is an algorithm for determining whether an input number is prime number. Amongst other fields of mathematics, it is used for cryptography....
s. These typically pick a random number called a "witness" and check some formula involving the witness and the potential prime N. After several iterations, they declare N to be "definitely composite" or "probably prime". Some of these tests are not perfect: there may be some composite numbers, called pseudoprime
Pseudoprime

A pseudoprime is a probable prime which is not actually prime. Pseudoprimes can be classified according to which property they satisfy.The most important class of pseudoprimes come from Fermat's little theorem and hence are called Fermat pseudoprimes....
s for the respective test, that will be declared "probably prime" no matter what witness is chosen. However, the most popular probabilistic tests do not suffer from this drawback.

One method for determining whether a number is prime is to divide by all primes less than or equal to the square root of that number. If any of the divisions come out as an integer, then the original number is not a prime. Otherwise, it is a prime. One need not actually calculate the square root; once one sees that the quotient
Quotient

In mathematics, a quotient is the result of a division . For example, when dividing 6 by 3, the quotient is 2, while 6 is called the division , and 3 the divisor....
 is less than the divisor, one can stop. More precisely, the last prime factor possibility for some number N would be Prime(m) where Prime(m + 1) squared exceeds N. This is known as trial division; it is the simplest primality test and it quickly becomes impractical for testing large integers because the number of possible factors grows too rapidly as the number-to-be-tested increases.

The number of prime numbers less than N is near



So, to check N for primality the largest prime factor needed is just less than , and so the number of such prime factor candidates would be close to



This increases ever more slowly with N, but, because there is interest in large values for N, the count is large also: for N = 10 20 it is 450 million.

Primality tests


A primality test algorithm
Primality test

A primality test is an algorithm for determining whether an input number is prime number. Amongst other fields of mathematics, it is used for cryptography....
 is an algorithm which tests a number for primality, i.e. whether the number is a prime number.

  • AKS primality test
    AKS primality test

    The AKS primality test is a deterministic algorithm primality test algorithm created and published by three Indian Institute of Technology Kanpur computer scientists, Manindra Agrawal, Neeraj Kayal, and Nitin Saxena on August 6, 2002 in a paper titled PRIMES is in P....
  • Fermat primality test
    Fermat primality test

    The Fermat primality test is a randomized algorithm test to determine if a number is Probable prime....
  • Lucas–Lehmer test
    Lucas–Lehmer test

    In computational number theory, the Lucas?Lehmer test is a primality test for a natural number n; it requires that the prime number#Prime divisors of n − 1 be already known....
  • Solovay–Strassen primality test
  • Miller–Rabin primality test
  • Elliptic curve primality proving
    Elliptic curve primality proving

    Elliptic Curve Primality Proving is a method based on elliptic curves to prove the prime number of a number. It is a general-purpose algorithm, meaning it does not depend on the number being a special form....


A probable prime
Probable prime

In number theory, a probable prime is an integer that satisfies a specific condition also satisfied by all prime numbers. Different types of probable primes have different specific conditions....
 is an integer which, by virtue of having passed a certain test, is considered to be probably prime. Probable primes which are in fact composite (such as Carmichael number
Carmichael number

In number theory, a Carmichael number is a composite number positive integer which satisfies the congruence for all integers which are relatively prime to ....
s) are called pseudoprime
Pseudoprime

A pseudoprime is a probable prime which is not actually prime. Pseudoprimes can be classified according to which property they satisfy.The most important class of pseudoprimes come from Fermat's little theorem and hence are called Fermat pseudoprimes....
s.

In 2002, Indian scientists at IIT Kanpur discovered a new deterministic algorithm known as the AKS algorithm
AKS primality test

The AKS primality test is a deterministic algorithm primality test algorithm created and published by three Indian Institute of Technology Kanpur computer scientists, Manindra Agrawal, Neeraj Kayal, and Nitin Saxena on August 6, 2002 in a paper titled PRIMES is in P....
. The amount of time that this algorithm takes to check whether a number N is prime depends on a polynomial function of the number of digits of N
P (complexity)

In computational complexity theory, P, also known as PTIME or DTIME, is one of the most fundamental complexity classes. It contains all decision problems which can be solved by a deterministic Turing machine using a polynomial amount of computation time, or polynomial time....
 (i.e. of the logarithm of N).

Formulas yielding prime numbers


There is no known formula for primes
Formula for primes

In mathematics, a formula for primes is a formula generating the prime numbers, exactly and without exception. No easily-computable such formula is known....
 which is more efficient at finding primes than the methods mentioned above under “Finding prime numbers”.

There is a set of Diophantine equations in 9 variables and one parameter with the following property: the parameter is prime if and only if the resulting system of equations has a solution over the natural numbers. This can be used to obtain a single formula with the property that all its positive values are prime.

There is no polynomial
Polynomial

In mathematics, a polynomial is an expression constructed from variables and constants, using the operations of addition, subtraction, multiplication, and constant non-negative whole number exponents....
, even in several variables, that takes only prime values. For example, the curious polynomial in one variable f(n) = n2 - n + 41 yields primes for n = 0,…, 40,43 but f(41) and f(42) are composite. However, there are polynomials in several variables, whose positive values (as the variables take all positive integer values) are exactly the primes (for an example, see formula for primes
Formula for primes

In mathematics, a formula for primes is a formula generating the prime numbers, exactly and without exception. No easily-computable such formula is known....
).

Another formula is based on Wilson's theorem mentioned above, and generates the number 2 many times and all other primes exactly once. There are other similar formulas which also produce primes.

Special types of primes from formulas for primes
A prime p is called primorial
Primorial prime

In mathematics, primorial primes are prime numbers of the form pn# ? 1, where:The first few primorial primes are, the largest known primorial prime is 392113#+1 with 169966 digits, found in 2001 by Daniel Heuer....
 or prime-factorial if it has the form p = n# ± 1 for some number n, where n#
Primorial

The name primorial is attributed to Harvey Dubner and is a portmanteau of prime number and factorial. There are two definitions for primorial: one for prime numbers and one for natural numbers....
 stands for the product 2 · 3 · 5 · 7 · 11 · … of all the primes = n. A prime is called factorial
Factorial prime

A factorial prime is a prime number that is one less or one more than a factorial . The first few factorial primes are:n! − 1 is prime for :...
 if it is of the form n!
Factorial

In mathematics, the factorial of a negative and non-negative numbers integer n, denoted by n!, is the Product of all positive integers less than or equal to n....
 ± 1. The first factorial primes are:

n! − 1 is prime for n = 3, 4, 6, 7, 12, 14, 30, 32, 33, 38, 94, 166, 324, …


n! + 1 is prime for n = 0, 1, 2, 3, 11, 27, 37, 41, 73, 77, 116, 154, 320, …


The largest known primorial prime is ?(392113) + 1, found by Heuer in 2001. The largest known factorial prime is 34790! - 1, found by Marchal, Carmody and Kuosa in 2002. It is not known whether there are infinitely many primorial or factorial primes.

Primes of the form 2p - 1, where p is a prime number, are known as Mersenne prime
Mersenne prime

In mathematics, a Mersenne number is a positive integer that is one less than a power of two:Some definitions of Mersenne numbers require that the exponent n be prime....
s, while primes of the form are known as Fermat primes. Prime numbers p where 2p + 1 is also prime are known as Sophie Germain prime
Sophie Germain prime

In number theory, a prime number p is a Sophie Germain prime if 2p + 1 is also prime. For example, 23 is a Sophie Germain prime because it is a prime and 2 × 23 + 1 = 47, also prime....
s. The following list is of other special types of prime numbers that come from formulas:

Some primes are classified according to the properties of their digits in decimal or other bases. For example, numbers whose digits form a palindromic
Palindrome

A palindrome is a word, phrase, palindromic number or other sequence of units that can be read the same way in either direction . Composing literature in palindromes is an example of constrained writing....
 sequence are called palindromic prime
Palindromic prime

A palindromic prime is a prime number that is also a palindromic number. Palindromicity depends on the Radix of the numbering system and its writing conventions, while primality is independent of such concerns....
s, and a prime number is called a truncatable prime
Truncatable prime

In number theory, a left-truncatable prime is a prime number which, in a given Radix, contains no 0, and if the leading digit is successively removed, then all resulting numbers are prime....
 if successively removing the first digit at the left or the right yields only new prime numbers.
  • For a list of special classes of prime numbers? see List of prime numbers?


Distribution

The problem of modeling the distribution of prime numbers is a popular subject of investigation for number theorists. The occurrence of individual prime numbers among the natural number
Natural number

In mathematics, a natural number can mean either an element of the Set = *n = = ? = ? ...
s is (so far) unpredictable, even though there are laws (such as the prime number theorem
Prime number theorem

In number theory, the prime number theorem describes the asymptotic analysis distribution of the prime numbers. The prime number theorem gives a rough description of how the primes are distributed....
 and Bertrand's postulate
Bertrand's postulate

Bertrand's postulate states that if n > 3 is an integer, then there always exists at least one prime number p with n < p < 2n − 2....
) that govern their average distribution. Leonhard Euler
Leonhard Euler

Leonhard Paul Euler was a pioneering Swiss mathematician and physicist who spent most of his life in Russia and Germany.Euler made important discoveries in fields as diverse as calculus and graph theory....
 commented
Mathematicians have tried in vain to this day to discover some order in the sequence of prime numbers, and we have reason to believe that it is a mystery into which the mind will never penetrate.
In a 1975 lecture, Don Zagier
Don Zagier

Don Bernhard Zagier is an United States mathematician whose main area of work is number theory. He is currently one of the directors of the Max-Planck-Institut f?r Mathematik in...
 commented
There are two facts about the distribution of prime numbers of which I hope to convince you so overwhelmingly that they will be permanently engraved in your hearts. The first is that, despite their simple definition and role as the building blocks of the natural numbers, the prime numbers grow like weeds among the natural numbers, seeming to obey no other law than that of chance, and nobody can predict where the next one will sprout. The second fact is even more astonishing, for it states just the opposite: that the prime numbers exhibit stunning regularity, that there are laws governing their behavior, and that they obey these laws with almost military precision.


Additional image with 2310 columns is linked here, preserving multiples of 2, 3, 5, 7, 11 in respective columns. Predictably, prime numbers fall into columns if the numbers are arranged from left to right and the width is a multiple of a prime number. More surprisingly, when arranged in a spiral such as the Ulam spiral
Ulam spiral

The Ulam spiral, or prime spiral is a simple method of Graph the prime numbers that reveals a pattern. It was discovered by the mathematician Stanislaw Ulam in 1963, while he was doodling on scratch paper at a scientific meeting....
, prime numbers cluster on certain diagonals and not others.

Gaps between primes


Let pn denote the nth prime number (i.e. p1 = 2, p2 = 3, etc.). The gap gn between the consecutive primes pn and pn + 1 is the difference between them, i.e.

gn = pn + 1pn.


We have g1 = 3 − 2 = 1, g2 = 5 − 3 = 2, g3 = 7 − 5 = 2, g4 = 11 − 7 = 4, and so on. The sequence (gn) of prime gaps has been extensively studied.

For any natural number N larger than 1, the sequence (for the notation N! read factorial
Factorial

In mathematics, the factorial of a negative and non-negative numbers integer n, denoted by n!, is the Product of all positive integers less than or equal to n....
)

N! + 2, N! + 3, …, N! + N


is a sequence of N − 1 consecutive composite integers. Therefore, there exist gaps between primes which are arbitrarily large, i.e. for any natural number N, there is an integer n with gn > N. (Choose n so that pn is the greatest prime number less than N! + 2.)

On the other hand, the gaps get arbitrarily small in proportion to the primes: the quotient gn/pn approaches
Limit (mathematics)

In mathematics, the concept of a "limit" is used to describe the behavior of a Function as its argument or input either "gets close" to some point, or as the argument becomes arbitrarily large; or the behavior of a sequence's elements as their index increases indefinitely....
 zero as n approaches infinity. Note also that the twin prime conjecture
Twin prime conjecture

The twin prime conjecture is a famous unsolved problem in number theory that involves prime numbers. It states:Such a pair of prime numbers is called a twin prime....
 asserts that gn = 2 for infinitely many integers n.

Location of the largest known prime


, the largest known prime was discovered by the distributed computing
Distributed computing

Distributed computing deals with hardware and software systems containing more than one processing element or Computer data storage element, Concurrent computing processes, or multiple programs, running under a loosely or tightly controlled regime....
 project Great Internet Mersenne Prime Search
Great Internet Mersenne Prime Search

The Great Internet Mersenne Prime Search is a collaborative project of volunteers who use Prime95 and MPrime computer software that can be downloaded from the Internet for free in order to search for Mersenne prime....
 (GIMPS):

243,112,609 - 1.


This was found to be a prime number on August 23, 2008. This number is 12,978,189 digits long and is (chronologically) the 45th known Mersenne prime. The 46th known Mersenne prime, 237,156,667 - 1, was discovered two weeks later, but it is smaller.

Historically, the largest known prime has almost always been a Mersenne prime since the dawn of electronic computers, because there exists a particularly fast primality test for numbers of this form, the Lucas–Lehmer test for Mersenne numbers
Lucas–Lehmer test for Mersenne numbers

In mathematics, the Lucas?Lehmer test is a primality test for Mersenne primes. The test was originally developed by Edouard Lucas in 1856 , and subsequently improved by Lucas in 1878 and Derrick Henry Lehmer in the 1930s....
.

The largest known prime that is not a Mersenne prime is 19,249 × 213,018,586 + 1 (3,918,990 digits), a Proth number
Proth number

In number theory, a Proth number is a number of the formwhere k is odd number, n is a positive integer, and 2n > k....
. This is also the seventh largest known prime of any form. It was found on March 26, 2007 by the Seventeen or Bust
Seventeen or Bust

Seventeen or Bust is a distributed computing project started in March 2002 to solve the last seventeen cases in the Sierpinski number....
 project and it brings them one step closer to solving the Sierpinski problem
Sierpinski number

In number theory, a Sierpinski number is an odd natural number k such that integers of the form k2n + 1 are composite number for all natural numbers n....
.

Some of the largest primes not known to have any particular form (that is, no simple formula such as that of Mersenne primes) have been found by taking a piece of semi-random binary data, converting it to a number n, multiplying it by 256k for some positive integer k, and searching for possible primes within the interval [256kn + 1, 256k(n + 1) − 1].

Awards for finding primes

The Electronic Frontier Foundation
Electronic Frontier Foundation

The Electronic Frontier Foundation is an international non-profit organization advocacy and legal organization based in the United States with the stated purpose of being dedicated to preserving the right to freedom of speech, such as protected by the First Amendment to the United States Constitution, in the context of today's digital age ....
 (EFF) has offered a US$100,000 prize to the first discoverers of a prime with at least 10 million digits. They also offer $150,000 for 100 million digits, and $250,000 for 1 billion digits. In 2000 they paid out $50,000 for 1 million digits. They may pay out $100,000 to GIMPS and the UCLA mathematics department for discovering a 13 million digit prime number in August 2008.

The RSA Factoring Challenge
RSA Factoring Challenge

The RSA Factoring Challenge was a challenge put forward by RSA Laboratories on March 18 1991 to encourage research into computational number theory and the practical difficulty of Factorization large integers and cracking RSA keys used in cryptography....
 offered prizes up to US$200,000 for finding the prime factors of certain semiprime
Semiprime

In mathematics, a semiprime is a natural number that is the product of two prime numbers. The first few semiprimes are 4, 6, 9, 10, 14, 15, 21, 22, 25, 26, ......
s of up to 2048 bits. However, the challenge was closed in 2007 after much smaller prizes for smaller semiprimes had been paid out.

Generalizations of the prime concept


The concept of prime number is so important that it has been generalized in different ways in various branches of mathematics.

Prime elements in rings


One can define prime elements and irreducible element
Irreducible element

In mathematics, a non-unit in an integral domain is said to be irreducible if it is not a product of two non-units.Every prime element is irreducible. The converse is true for unique factorization domains ...
s in any integral domain
Integral domain

In abstract algebra, an integral domain is a commutative ring without zero divisors and with a multiplicative identity 1 not equal to 0, the additive identity....
. For any unique factorization domain
Unique factorization domain

In mathematics, a unique factorization domain is, roughly speaking, a commutative ring in which every element, with special exceptions, can be uniquely written as a product of prime elements, analogous to the fundamental theorem of arithmetic for the integers....
, such as the ring Z of integers, the set of prime elements equals the set of irreducible elements, which for Z is .

As an example, we consider the Gaussian integer
Gaussian integer

A Gaussian integer is a complex number whose real and imaginary part are both integers. The Gaussian integers, with ordinary addition and multiplication of complex numbers, form an integral domain, usually written as Z[i]....
s Z[i], that is, complex numbers of the form a + bi with a and b in Z. This is an integral domain, and its prime elements are the Gaussian primes. Note that 2 is not a Gaussian prime, because it factors into the product of the two Gaussian primes (1 + i) and (1 - i). The element 3, however, remains prime in the Gaussian integers. In general, rational primes (i.e. prime elements in the ring Z of integers) of the form 4k + 3 are Gaussian primes, whereas rational primes of the form 4k + 1 are not.

Prime ideals


In ring theory
Ring theory

In mathematics, ring theory is the study of ring , algebraic structures in which addition and multiplication are defined and have similar properties to those familiar from the integers....
, one generally replaces the notion of number with that of ideal
Ideal (ring theory)

In ring theory, a branch of abstract algebra, an ideal is a special subset of a ring . The ideal concept generalizes in an appropriate way some important properties of integers like "even number" or "multiple of 3"....
. Prime ideal
Prime ideal

In mathematics, a prime ideal is a subset of a ring which shares many important properties of a prime number in the ring of integers. This article only covers ideals of ring theory....
s
are an important tool and object of study in commutative algebra
Commutative algebra

Commutative algebra is the branch of abstract algebra that studies commutative rings, their ideal , and module over such rings. Both algebraic geometry and algebraic number theory build on commutative algebra....
, algebraic number theory
Number theory

Number theory is the branch of pure mathematics concerned with the properties of numbers in general, and integers in particular, as well as the wider classes of problems that arise from their study....
 and algebraic geometry
Algebraic geometry

Algebraic geometry is a branch of mathematics which, as the name suggests, combines techniques of abstract algebra, especially commutative algebra, with the language and the problems of geometry....
. The prime ideals of the ring of integers are the ideals (0), (2), (3), (5), (7), (11), …

A central problem in algebraic number theory is how a prime ideal factors when it is lifted to an extension field. For example, in the Gaussian integer example above, (2) ramifies into a prime power (1 + i and 1 - i generate the same prime ideal), prime ideals of the form (4k + 3) are inert (remain prime), and prime ideals of the form (4k + 1) split (are the product of 2 distinct prime ideals).

Primes in valuation theory


In algebraic number theory, yet another generalization is used. Given an arbitrary field
Field (mathematics)

In abstract algebra, a field is an algebraic structure with notions of addition, subtraction, multiplication and division , satisfying certain axioms....
 K, one considers valuation
Valuation

Valuation may refer to:*Valuation , the determination of the economic value of an asset or liability*Valuation , the determination of the ethic or philosophic value of an object ...
s on K, certain functions from K to the real numbers R. Every such valuation yields a topology on K, and two valuations are called equivalent if they yield the same topology. A prime of K (sometimes called a place of K) is an equivalence class
Equivalence class

In mathematics, given a Set X and an equivalence relation ~ on X, the equivalence class of an element a in X is the subset of all elements in X which are equivalent to a:...
 of valuations. With this definition, the primes of the field Q of rational number
Rational number

In mathematics, a rational number is a number which can be expressed as a quotient of two integers. Non-integer rational numbers are usually written as the vulgar fraction , where b is not 0 ....
s are represented by the standard absolute value
Absolute value

In mathematics, the absolute value of a real number is its numerical value without regard to its Negative and non-negative numbers. So, for example, 3 is the absolute value of both 3 and -3....
 function (known as the infinite prime) as well as by the p-adic valuations
P-adic number

In mathematics, the p-adic number systems were first described by Kurt Hensel in 1897. For each prime number p, the p-adic number system extends the ordinary arithmetic of the rational numbers in a way different from the extension of the rational number system to the real number and complex number systems....
 on Q, for every prime number p.

Prime knots


In knot theory
Knot theory

In mathematics, knot theory is the area of topology that studies knot s. While inspired by knots which appear in daily life in shoelaces and rope, a mathematician's knot differs drastically in that the ends are joined together to prevent it from becoming undone....
, a prime knot is a knot
Knot (mathematics)

In mathematics, a knot is an embedding of a circle in 3-dimensional Euclidean space, R3, considered up to continuous deformations ....
 which is, in a certain sense, indecomposable. Specifically, it is one which cannot be written as the knot sum of two nontrivial knots.

Open questions


There are many open questions about prime numbers. A very significant one is the Riemann hypothesis
Riemann hypothesis

In mathematics, the Riemann hypothesis, due to , is a conjecture about the distribution of the Root of the Riemann zeta function stating that all non-trivial zeros of the Riemann zeta function have real part 1/2....
, which essentially says that the primes are as regularly distributed as possible. From a physical viewpoint, it roughly states that the irregularity in the distribution of primes only comes from random noise. From a mathematical viewpoint, it roughly states that the asymptotic distribution of primes (about 1/ log x of numbers less than x are primes, the prime number theorem
Prime number theorem

In number theory, the prime number theorem describes the asymptotic analysis distribution of the prime numbers. The prime number theorem gives a rough description of how the primes are distributed....
) also holds for much shorter intervals of length about the square root of x (for intervals near x). This hypothesis is generally believed to be correct. In particular, the simplest assumption is that primes should have no significant irregularities without good reason.

Many famous conjectures appear to have a very high probability of being true (in a formal sense, many of them follow from simple heuristic probabilistic arguments):

  • Prime Euclid number
    Euclid number

    In mathematics, Euclid numbers are integers of the form E'n = p'n# + 1, where p'n# is the primorial of p'n which is the nth prime....
    s: It is not known whether or not there are an infinite number of prime Euclid numbers.
  • Strong Goldbach conjecture
    Goldbach's conjecture

    Goldbach's conjecture is one of the oldest unsolved problems in mathematicss in number theory and in all of mathematics. It states:Expressing a given even number as a sum of two primes is called a Goldbach Partition of the number....
    : Every even integer greater than 2 can be written as a sum of two primes.
  • Weak Goldbach conjecture
    Goldbach's weak conjecture

    In number theory, Goldbach's weak conjecture, also known as the odd Goldbach conjecture, the ternary Goldbach problem, or the 3-primes problem, states that:...
    : Every odd integer greater than 5 can be written as a sum of three primes.
  • Twin prime conjecture
    Twin prime conjecture

    The twin prime conjecture is a famous unsolved problem in number theory that involves prime numbers. It states:Such a pair of prime numbers is called a twin prime....
    : There are infinitely many twin prime
    Twin prime

    A twin prime is a prime number that differs from another prime number by two. Except for the pair , this is the smallest possible difference between two primes....
    s, pairs of primes with difference 2.
  • Polignac's conjecture
    Polignac's conjecture

    In number theory, Polignac's conjecture was made by Alphonse de Polignac in 1849 and states:The conjecture has not been proven or disproven for any value of n....
    : For every positive integer n, there are infinitely many pairs of consecutive primes which differ by 2n. When n = 1 this is the twin prime conjecture.
  • A weaker form of Polignac's conjecture: Every even number is the difference of two primes.
  • It is widely believed there are infinitely many Mersenne prime
    Mersenne prime

    In mathematics, a Mersenne number is a positive integer that is one less than a power of two:Some definitions of Mersenne numbers require that the exponent n be prime....
    s, but not Fermat primes.
  • It is conjectured there are infinitely many primes of the form n2 + 1.
  • Many well-known conjectures are special cases of the broad Schinzel's hypothesis H
    Schinzel's hypothesis H

    In mathematics, Andrzej Schinzel's hypothesis H is a very broad generalisation of conjectures such as the twin prime conjecture. It aims to define the maximum possible scope of a conjecture of the nature that a family...
    .
  • It is conjectured that there are infinitely many Fibonacci prime
    Fibonacci prime

    A Fibonacci prime is a Fibonacci number that is prime number.The first Fibonacci primes are :...
    s.
  • Legendre's conjecture
    Legendre's conjecture

    Legendre's conjecture, proposed by Adrien-Marie Legendre, states that there is a prime number between n2 and 2 for every positive integer n....
    : There is a prime number between n2 and (n + 1)2 for every positive integer n.
  • Cramér's conjecture
    Cramér's conjecture

    In number theory, Cram?r's conjecture, formulated originally by the Sweden mathematician Harald Cram?r in 1936 , states thatwhere pn denotes the nth prime number and "log" is the natural logarithm....
    : . This conjecture implies Legendre's, but its status is more unsure.
  • Brocard's conjecture
    Brocard's conjecture

    In number theory, Brocard's conjecture is a conjecture that there are at least four prime numbers between 2 and 2, for n > 1, where pn is the nth prime number....
    : There are always at least four primes between the squares of consecutive primes greater than 2.


All four of Landau's problems
Landau's problems

At the 1912 International Congress of Mathematicians, Edmund Landau listed four basic problems about prime number. These problems were characterised in his speech as "unattackable at the present state of science" and are now known as Landau's problems....
 from 1912 are listed above and still unsolved: Goldbach, twin primes, Legendre, n2+1 primes.

Applications


For a long time, number theory in general, and the study of prime numbers in particular, was seen as the canonical example of pure mathematics, with no applications outside of the self-interest of studying the topic. In particular, number theorists such as British
United Kingdom

The United Kingdom of Great Britain and Northern Ireland, commonly known as the United Kingdom , the UK or Britain,is a sovereign state located off the northwestern coast of continental Europe....
 mathematician G. H. Hardy
G. H. Hardy

G. H. Hardy Fellow of the Royal Society was a prominent England mathematics, known for his achievements in number theory and mathematical analysis....
 prided themselves on doing work that had absolutely no military significance. However, this vision was shattered in the 1970s, when it was publicly announced that prime numbers could be used as the basis for the creation of public key cryptography algorithms. Prime numbers are also used for hash table
Hash table

In computer science, a hash table, or a hash map, is a data structure that associates Unique key with value .The primary operation that hash functions support efficiently is a lookup: given a key , find the corresponding value ....
s and pseudorandom number generator
Pseudorandom number generator

A pseudorandom number generator is an algorithm for generating a sequence of numbers that approximates the properties of random numbers. The sequence is not truly random in that it is completely determined by a relatively small set of initial values, called the PRNG's state. Although sequences that are closer to truly random can be gen...
s.

Some rotor machine
Rotor machine

In cryptography, a rotor machine is an electro-mechanical device used for encryption and decrypting secret messages. Rotor machines were the cryptographic state-of-the-art for a brief but prominent period of history; they were in widespread use in the 1930s–1950s....
s were designed with a different number of pins on each rotor, with the number of pins on any one rotor either prime, or coprime
Coprime

In mathematics, the integers a and b are said to be coprime or relatively prime if they have no common divisor other than 1 or, equivalently, if their greatest common divisor is 1....
 to the number of pins on any other rotor. This helped generate the full cycle
Full Cycle

A full cycle is a mathematical term that represents a traversal over a set of non-random numbers. A full cycle implies that every number in the set was chosen exactly once before repeating....
 of possible rotor positions before repeating any position.

Public-key cryptography


Several public-key cryptography algorithms, such as RSA
RSA

In cryptography, RSA is an algorithm for public-key cryptography. It is the first algorithm known to be suitable for digital signature as well as encryption, and one of the first great advances in public key cryptography....
, are based on large prime numbers (for example with 512 bit
Bit

A bit is a binary numeral system numerical digit, taking a value of either 0 or 1. Binary digits are a basic unit of information Computer data storage and transmission in digital computing and digital information theory....
s).

Prime numbers in nature

Inevitably, some of the numbers that occur in nature are prime. There are, however, relatively few examples of numbers that appear in nature because they are prime.

One example of the use of prime numbers in nature is as an evolutionary strategy used by cicada
Cicada

A cicada is an insect of the order Hemiptera, suborder Auchenorrhyncha, in the superfamily Cicadoidea, with large eyes wide apart on the head and usually transparent, well-veined wings....
s of the genus Magicicada
Magicicada

Magicicada is the genus of the 13- and 17-year periodical cicadas of eastern North America. These insects display a combination of long life cycles, periodicity, and mass emergences....
. These insects spend most of their lives as grubs
Larva

A larva is a young form of animal with indirect developmental biology, going through or undergoing metamorphosis .The larva can look completely different from the adult form, for example, a caterpillar differs from a butterfly....
 underground. They only pupate and then emerge from their burrows after 13 or 17 years, at which point they fly about, breed, and then die after a few weeks at most. The logic for this is believed to be that the prime number intervals between emergences makes it very difficult for predators to evolve that could specialise as predators on Magicicadas. If Magicicadas appeared at a non-prime number intervals, say every 12 years, then predators appearing every 2, 3, 4, 6, or 12 years would be sure to meet them. Over a 200-year period, average predator populations during hypothetical outbreaks of 14- and 15-year cicadas would be up to 2% higher than during outbreaks of 13- and 17-year cicadas. Though small, this advantage appears to have been enough to drive natural selection in favour of a prime-numbered life-cycle for these insects.

There is speculation that the zeros of the zeta function
Zeta function

In mathematics, a zeta function is a function which is composed of an infinite sum of powers, that is, which may be written as a Dirichlet series:...
 are connected to the energy levels of complex quantum systems.

In the arts and literature

Prime numbers have influenced many artists and writers. The French composer
Composer

A composer is a person who creates music, usually in the medium of musical notation, for interpretation and performance. The level of distinction between composers and other musicians varies, which affects issues such as copyright and the deference given to individual interpretations of a particular piece of music....
 Olivier Messiaen
Olivier Messiaen

Olivier Messiaen was a French composer, organ , and ornithology. He entered the Conservatoire de Paris at the age of 11 and numbered Paul Dukas, Maurice Emmanuel, Charles-Marie Widor and Marcel Dupr? among his teachers....
 used prime numbers to create ametrical music through "natural phenomena". In works such as La Nativité du Seigneur
La Nativité du Seigneur

File:?glise de la Sainte-Trinit? de Paris.jpgLa Nativit? du Seigneur is a work for organ, written by the French composer Olivier Messiaen in 1935....
 (1935) and Quatre études de rythme (1949-50), he simultaneously employs motifs with lengths given by different prime numbers to create unpredictable rhythms: the primes 41, 43, 47 and 53 appear in one of the études. According to Messiaen this way of composing was "inspired by the movements of nature, movements of free and unequal durations".

In his science fiction novel Contact
Contact (novel)

Contact is a science fiction novel written by Carl Sagan and published in 1985.A Contact of the novel starring Jodie Foster was released in 1997....
, later made into a film of the same name
Contact (film)

Contact is a 1997 science fiction film drama film directed by Robert Zemeckis and adapted from the Carl Sagan Contact . Both Sagan and wife Ann Druyan wrote the story outline for the film adaptation of Contact and also served as co-producers....
, the NASA
NASA

The National Aeronautics and Space Administration is an agency of the Federal government of the United States, responsible for the nation's public list of space agencies....
 scientist Carl Sagan
Carl Sagan

Carl Edward Sagan, Ph.D. was an United States astronomer, Astrochemistry, author, and highly successful popularizer of astronomy, astrophysics and other natural sciences....
 suggested that prime numbers could be used as a means of communicating with aliens, an idea that he had first developed informally with American astronomer Frank Drake
Frank Drake

Dr. Frank Donald Drake is an American astronomer and astrophysicist. He is most famous for founding SETI and creating the Drake equation and Arecibo Message....
 in 1975.

Tom Stoppard
Tom Stoppard

Sir Tom Stoppard Order of Merit , Order of the British Empire, FRSL is a British screenwriter and playwright. He has written plays such as The Coast of Utopia, Arcadia , Rosencrantz & Guildenstern Are Dead, and Rock 'n' Roll ....
's award-winning 1993 play Arcadia
Arcadia (play)

Arcadia is a 1993 Play by Tom Stoppard concerning the relationship between past and present and between order and disorder and the certainty of knowledge....
 was a conscious attempt to discuss mathematical ideas on the stage. In the opening scene, the 13 year old heroine puzzles over Fermat's Last Theorem
Fermat's Last Theorem

Fermat's Last Theorem is the name of the statement in number theory that states that:or, more precisely:In 1637 Pierre de Fermat wrote, in his copy of Claude Gaspard Bachet de M?ziriac's translation of the famous Arithmetica of Diophantus, "I have a truly marvellous proof of this proposition which this margin is too narrow to con...
, a theorem involving prime numbers.

Many films reflect a popular fascination with the mysteries of prime numbers and cryptography: films such as Cube
Cube (film)

Cube is a 1997 in film Canada psychological thriller/horror /science fiction film film director by Vincenzo Natali. The film was a very successful product of the Canadian Film Centre's First Feature Project....
, Sneakers
Sneakers (film)

Sneakers is a 1992 caper story film directed by Phil Alden Robinson and written by Robinson, Walter F. Parkes and Lawrence Lasker. It was filmed in late 1991 and released in 1992....
, The Mirror Has Two Faces
The Mirror Has Two Faces

The Mirror Has Two Faces is a 1996 in film United States romance film dramedy film produced and directed by Barbra Streisand, who also stars....
 and A Beautiful Mind
A Beautiful Mind (film)

A Beautiful Mind is a 2001 in film United States film based on the life of John Forbes Nash, a Bank of Sweden Prize in Economic Sciences in Memory of Alfred Nobel....
, the latter of which is based on the biography of the mathematician and Nobel laureate John Forbes Nash
John Forbes Nash

John Forbes Nash, Jr. , is an American mathematician and economist whose works in game theory, differential geometry, and partial differential equations provided insight into the forces that govern chance and events inside complex systems in daily life....
 by Sylvia Nasar
Sylvia Nasar

Sylvia Nasar is a German economist and author, best known for her biography of John Forbes Nash, A Beautiful Mind ....
.

In the novel PopCo
PopCo

PopCo is a novel by British author Scarlett Thomas. It tells a story of twenty-nine-year-old Alice Butler, a quirky, fiercely intelligent loner with an affinity for secret codes and mathematics....
 by Scarlett Thomas
Scarlett Thomas

Scarlett Thomas is an English author. She has written seven novels, including The End of Mr. Y and PopCo, and teaches English literature at the University of Kent....
 the main character, Alice Butler's grandmother works on proving the Riemann Hypothesis
Riemann hypothesis

In mathematics, the Riemann hypothesis, due to , is a conjecture about the distribution of the Root of the Riemann zeta function stating that all non-trivial zeros of the Riemann zeta function have real part 1/2....
. In the book, a table of the first 1000 prime numbers is displayed.

See also


Distributed computing projects that search for primes

  • GIMPS
    Great Internet Mersenne Prime Search

    The Great Internet Mersenne Prime Search is a collaborative project of volunteers who use Prime95 and MPrime computer software that can be downloaded from the Internet for free in order to search for Mersenne prime....
     searches for Mersenne prime
    Mersenne prime

    In mathematics, a Mersenne number is a positive integer that is one less than a power of two:Some definitions of Mersenne numbers require that the exponent n be prime....
    s.
  • PrimeGrid
    PrimeGrid

    PrimeGrid is a distributed computing project for searching for prime numbers of world-record size. It makes use of the Berkeley Open Infrastructure for Network Computing platform....
     searches for megaprime
    Megaprime

    A megaprime is a prime number with at least one million decimal digits .There are infinitude of primes and therefore infinitely many megaprimes....
    s.
  • Seventeen or Bust
    Seventeen or Bust

    Seventeen or Bust is a distributed computing project started in March 2002 to solve the last seventeen cases in the Sierpinski number....
     searches for primes which can help prove that 78557 is the smallest Sierpinski number
    Sierpinski number

    In number theory, a Sierpinski number is an odd natural number k such that integers of the form k2n + 1 are composite number for all natural numbers n....
    .
  • Twin Prime Search
    Twin Prime Search

    Twin Prime Search is a distributed computing project that looks for large twin primes. It uses the programs LLR and NewPGen . It was founded on April 13 2006 by Michael Kwok....
     searches for record twin prime
    Twin prime

    A twin prime is a prime number that differs from another prime number by two. Except for the pair , this is the smallest possible difference between two primes....
    s
  • Wieferich@Home
    Wieferich@Home

    Wieferich@Home is the Internet-based distributed computing project searching for Wieferich primes. It is the first Czech Republic DC project. The only known Wieferich primes are 1093 and 3511, found in 1913 and in 1922, respectively....
     searches for Wieferich prime
    Wieferich prime

    In number theory, a Wieferich prime is a prime number p such that p2 divides 2p − 1 − 1; compare this with Fermat's little theorem, which states that every odd prime p divides 2p − 1  − 1....
    s.


External links


  • Caldwell, Chris, The Prime Pages
    Prime pages

    The Prime Pages is a website about prime numbers maintained by Prof. Chris Caldwell at the University of Tennessee at University of Tennessee at Martin....
     at .
  • by Enrique Zeleny, Wolfram Demonstrations Project
    Wolfram Demonstrations Project

    The Wolfram Demonstrations Project is a website developed by Wolfram Research, whose stated goal is to bring computational exploration to the widest possible audience....
    .
  • from Plus, the free online mathematics magazine produced by the Millennium Mathematics Project at the University of Cambridge

Prime number generators & calculators

  • - instantly checks and finds prime numbers up to 128 digits long (does NOT require Java or Javascript)
  • — Check prime number, and find next largest and next smallest prime numbers (requires Javascript).
  • – Makes use of the Elliptic Curve Method (up to thousands digits numbers check!, requires Java)
  • — Generates a given number of primes above a given start number.
  • from WIMS is an online prime generator.