badge icon

This article was automatically translated from the original Turkish version.

Article

Prime Numbers

Prime numbers are integers greater than 1 that are divisible only by themselves and 1. Integers greater than 1 that are not prime are called composite numbers. For example, 17 is a prime number because it is divisible only by 1 and 17, whereas 6 is a composite number because it is also divisible by 2 and 3. The numbers 0 and 1 are neither prime nor composite. The smallest prime number is 2, and it is the only even prime number. No prime number greater than 5 ends in 5.

History and Fundamental Concepts

Prime numbers and their properties were first studied by ancient Greek mathematicians. Between 500 and 300 BCE, mathematicians of the Pythagorean school discovered the foundational properties of prime numbers. Around 300 BCE, Euclid proved in his work Elements that there are infinitely many prime numbers and established the fundamental theorem of arithmetic. This theorem states that every integer can be uniquely expressed as a product of prime numbers. In the 200s BCE, Eratosthenes developed an algorithm known as the Sieve of Eratosthenes to find all prime numbers up to a given limit.


In the 17th century, Pierre de Fermat developed important theorems related to prime numbers. According to Fermat's Little Theorem, if p is a prime number, then for any integer a, the congruence apa (mod p) holds. Euler extended Fermat's work by introducing the Euler totient function ϕ(n), which for n ≥ 1 gives the count of integers in the interval [1,n] that are coprime to n. According to Euler's Theorem, if n ≥ 1 and (a,n) = 1 (that is, a and n are coprime), then aϕ(n) ≡ 1 (mod n).

Distribution of Prime Numbers

The distribution of prime numbers—that is, how frequently they occur among the integers—is a central topic in number theory. As integers increase in size, the frequency of prime numbers decreases.

Prime Number Theorem

In the late 18th century, Carl Friedrich Gauss and Adrien-Marie Legendre proposed a formula to estimate the number of prime numbers less than a given number n, denoted by π(n). The theorem is expressed as:<span class="katex"><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord mathnormal" style="margin-right:0.03588em;">π</span><span class="mopen">(</span><span class="mord mathnormal">n</span><span class="mclose">)</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">∼</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:1.2154em;vertical-align:-0.52em;"></span><span class="mord">​</span><span class="mord"><span class="mopen nulldelimiter"></span><span class="mfrac"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.6954em;"><span style="top:-2.655em;"><span class="pstrut" style="height:3em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mathnormal mtight" style="margin-right:0.01968em;">l</span><span class="mord mathnormal mtight">n</span><span class="mopen mtight">(</span><span class="mord mathnormal mtight">n</span><span class="mclose mtight">)</span></span></span></span><span style="top:-3.23em;"><span class="pstrut" style="height:3em;"></span><span class="frac-line" style="border-bottom-width:0.04em;"></span></span><span style="top:-3.394em;"><span class="pstrut" style="height:3em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mathnormal mtight">n</span></span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.52em;"><span></span></span></span></span></span><span class="mclose nulldelimiter"></span></span></span></span></span>

and states that as n approaches infinity, π(n) approaches the value <span class="katex"><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1.2154em;vertical-align:-0.52em;"></span><span class="mord"><span class="mopen nulldelimiter"></span><span class="mfrac"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.6954em;"><span style="top:-2.655em;"><span class="pstrut" style="height:3em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mathnormal mtight" style="margin-right:0.01968em;">l</span><span class="mord mathnormal mtight">n</span><span class="mopen mtight">(</span><span class="mord mathnormal mtight">n</span><span class="mclose mtight">)</span></span></span></span><span style="top:-3.23em;"><span class="pstrut" style="height:3em;"></span><span class="frac-line" style="border-bottom-width:0.04em;"></span></span><span style="top:-3.394em;"><span class="pstrut" style="height:3em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mathnormal mtight">n</span></span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.52em;"><span></span></span></span></span></span><span class="mclose nulldelimiter"></span></span></span></span></span>. This theorem was independently proven in 1896 by Jacques Hadamard and Charles de la Vallée Poussin.

Riemann Zeta Function and Riemann Hypothesis

In the mid-19th century, Bernhard Riemann introduced the Riemann zeta function to investigate the distribution of prime numbers more deeply. The Riemann zeta function is defined for all complex numbers s ≠ 1 as:<span class="katex"><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.8889em;vertical-align:-0.1944em;"></span><span class="mord mathnormal">s</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel"><span class="mrel"><span class="mord vbox"><span class="thinbox"><span class="rlap"><span class="strut" style="height:0.8889em;vertical-align:-0.1944em;"></span><span class="inner"><span class="mord"><span class="mrel"></span></span></span><span class="fix"></span></span></span></span></span><span class="mrel">=</span></span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:0.6444em;"></span><span class="mord">1</span></span></span></span> and<span class="katex"><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord mathnormal" style="margin-right:0.07378em;">ζ</span><span class="mopen">(</span><span class="mord mathnormal">s</span><span class="mclose">)</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:2.9185em;vertical-align:-1.2671em;"></span><span class="mop op-limits"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:1.6514em;"><span style="top:-1.8829em;margin-left:0em;"><span class="pstrut" style="height:3.05em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mathnormal mtight">n</span><span class="mrel mtight">=</span><span class="mord mtight">1</span></span></span></span><span style="top:-3.05em;"><span class="pstrut" style="height:3.05em;"></span><span><span class="mop op-symbol large-op">∑</span></span></span><span style="top:-4.3em;margin-left:0em;"><span class="pstrut" style="height:3.05em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">∞</span></span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:1.2671em;"><span></span></span></span></span></span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mord"><span class="mopen nulldelimiter"></span><span class="mfrac"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:1.3214em;"><span style="top:-2.314em;"><span class="pstrut" style="height:3em;"></span><span class="mord"><span class="mord"><span class="mord mathnormal">n</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.5904em;"><span style="top:-2.989em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathnormal mtight">s</span></span></span></span></span></span></span></span></span></span><span style="top:-3.23em;"><span class="pstrut" style="height:3em;"></span><span class="frac-line" style="border-bottom-width:0.04em;"></span></span><span style="top:-3.677em;"><span class="pstrut" style="height:3em;"></span><span class="mord"><span class="mord">1</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.686em;"><span></span></span></span></span></span><span class="mclose nulldelimiter"></span></span></span></span></span>.The Riemann hypothesis conjectures that all nontrivial solutions of the equation <span class="katex"><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord mathnormal" style="margin-right:0.07378em;">ζ</span><span class="mopen">(</span><span class="mord mathnormal">s</span><span class="mclose">)</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:0.6444em;"></span><span class="mord">0</span></span></span></span> have real parts equal to <span class="katex"><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1.1901em;vertical-align:-0.345em;"></span><span class="mord"><span class="mopen nulldelimiter"></span><span class="mfrac"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.8451em;"><span style="top:-2.655em;"><span class="pstrut" style="height:3em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">2</span></span></span></span><span style="top:-3.23em;"><span class="pstrut" style="height:3em;"></span><span class="frac-line" style="border-bottom-width:0.04em;"></span></span><span style="top:-3.394em;"><span class="pstrut" style="height:3em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">1</span></span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.345em;"><span></span></span></span></span></span><span class="mclose nulldelimiter"></span></span></span></span></span>. This hypothesis provides deep insights into the distribution of prime numbers but remains unproven.

Special Types of Prime Numbers

Several special types of prime numbers are defined by specific formulas or properties:


  • Mersenne Primes: Primes of the form Mp = 2p − 1, where p is a prime number. Not every Mp is prime; for example, M11 = 2047 = 23 × 89 is composite. Mersenne primes are closely related to perfect numbers (numbers equal to the sum of their positive divisors excluding themselves). If 2p − 1 is a Mersenne prime, then 2p−1(2p − 1) is a perfect number. Most of the largest known primes are Mersenne primes, and new ones are sought through the "Great Internet Mersenne Prime Search" (GIMPS) project.


  • Fermat Primes: Primes of the form <span class="katex"><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.8333em;vertical-align:-0.15em;"></span><span class="mord"><span class="mord mathnormal" style="margin-right:0.13889em;">F</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.1514em;"><span style="top:-2.55em;margin-left:-0.1389em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathnormal mtight">n</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.15em;"><span></span></span></span></span></span></span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:0.9633em;vertical-align:-0.0833em;"></span><span class="mord"><span class="mord">2</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.88em;"><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight"><span class="mord mtight">2</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.7385em;"><span style="top:-2.931em;margin-right:0.0714em;"><span class="pstrut" style="height:2.5em;"></span><span class="sizing reset-size3 size1 mtight"><span class="mord mathnormal mtight">n</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mbin">+</span><span class="mspace" style="margin-right:0.2222em;"></span></span><span class="base"><span class="strut" style="height:0.6444em;"></span><span class="mord">1</span></span></span></span>


  • Wilson Primes: Primes p for which (p−1)! ≡ −1 (mod p2) holds (by Wilson's Theorem, (p−1)! ≡ −1 (mod p) holds for every prime p). Known Wilson primes are 5, 13, and 563. It is unknown whether there are infinitely many.


  • Sophie Germain Primes: A prime p is a Sophie Germain prime if 2p + 1 is also prime. For example, 2, 3, 5, 11, and 23 are Sophie Germain primes. These primes have been used in proving special cases of Fermat's Last Theorem.


  • Twin Primes: Pairs of primes differing by 2 (p and p + 2, both prime). Examples include (3,5), (5,7), and (11,13). It remains an open problem whether there are infinitely many twin primes.


  • Cullen Primes: Primes of the form Cn = n⋅2n + 1.


  • Palindromic Primes: Primes that read the same forwards and backwards (e.g., 11, 101, 131).


  • Factorial Primes: Primes of the form n! ± 1.


  • Ramanujan Primes: For any natural number n, the n-th Ramanujan prime is the smallest integer Rn such that for all x ≥ Rn, the inequality <span class="katex"><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord mathnormal" style="margin-right:0.03588em;">π</span><span class="mopen">(</span><span class="mord mathnormal">x</span><span class="mclose">)</span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mbin">−</span><span class="mspace" style="margin-right:0.2222em;"></span></span><span class="base"><span class="strut" style="height:1.095em;vertical-align:-0.345em;"></span><span class="mord mathnormal" style="margin-right:0.03588em;">π</span><span class="mopen">(</span><span class="mord"><span class="mopen nulldelimiter"></span><span class="mfrac"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.6954em;"><span style="top:-2.655em;"><span class="pstrut" style="height:3em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">2</span></span></span></span><span style="top:-3.23em;"><span class="pstrut" style="height:3em;"></span><span class="frac-line" style="border-bottom-width:0.04em;"></span></span><span style="top:-3.394em;"><span class="pstrut" style="height:3em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mathnormal mtight">x</span></span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.345em;"><span></span></span></span></span></span><span class="mclose nulldelimiter"></span></span><span class="mord">​</span><span class="mclose">)</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">≥</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:0.4306em;"></span><span class="mord mathnormal">n</span></span></span></span> holds.

Primality Tests

Various methods have been developed to determine whether a given integer is prime. Trial division may suffice for small numbers, but larger numbers require more sophisticated algorithms.


  • Sieve of Eratosthenes: An ancient and simple method for finding all primes up to a specified limit. The algorithm works by eliminating multiples of each prime starting from 2; numbers not eliminated are prime. Due to time complexity, it is impractical for very large numbers.


  • Deterministic Primality Tests: Algorithms that definitively determine whether a number is prime.


  • AKS Primality Test (Agrawal-Kayal-Saxena): The first general-purpose, deterministic primality test proven to run in polynomial time, developed in 2002.


  • Probabilistic Primality Tests: Tests that determine with high probability whether a number is prime, without guaranteeing certainty. They are generally faster than deterministic tests and widely used in cryptography. Repeating the test with multiple bases reduces the probability of error.


  • Fermat Primality Test: Based on Fermat's Little Theorem. If n is prime and a is coprime to n, then an−1 ≡ 1 (mod n). However, some composite numbers (Carmichael numbers) also satisfy this congruence.


  • Miller-Rabin Primality Test: An improvement over the Fermat test that more effectively detects pseudoprimes such as Carmichael numbers. It is a strong probabilistic primality test and widely used in practice.


  • Solovay-Strassen Primality Test: Uses Euler's criterion and the Jacobi symbol. It is slower than the Miller-Rabin test and thus less commonly used.


  • Lehmann Test: In this test, a value ba(p−1)/2 (mod p) is computed for randomly chosen a. If all computed b values are either 1 or −1 (but not all the same), then p may be considered prime.

Applications in Cryptology

Prime numbers are fundamental to modern cryptography, especially in public-key encryption systems. The security of these systems typically relies on the difficulty of factoring a large composite number into its two large prime factors.


  • RSA Encryption System: Developed by Ron Rivest, Adi Shamir, and Leonard Adleman in 1978. Its security depends on the difficulty of factoring a large integer into two large prime factors. Two distinct large primes p and q are chosen, and n = pq and ϕ(n) = (p−1)(q−1) are computed. The public key is (n,e) and the private key is (d), where e and d satisfy specific mathematical relationships.


  • Rabin Encryption System: Developed by Michael Rabin in 1979, it is similar to RSA and also relies on the difficulty of factoring composite numbers.


To generate prime numbers, a random number is first selected and made odd. It is then checked for divisibility by small primes, followed by probabilistic primality tests such as Miller-Rabin.

New Methods and Unsolved Problems

Research into the detection and properties of prime numbers continues. New methods for finding primes and improvements to existing algorithms are being developed. New concepts such as perfectly secure prime sequences are being defined, and their potential applications in cryptographic systems are being explored.


Many problems related to prime numbers remain unsolved:

  • Riemann Hypothesis
  • Goldbach Conjecture (whether every even number greater than 2 can be expressed as the sum of two primes)
  • Twin Prime Conjecture (whether there are infinitely many twin primes)
  • Whether there are infinitely many Mersenne, Fermat, or Wilson primes.


Solving these problems could lead to major advances in number theory and other areas of mathematics.

Author Information

Avatar
AuthorYunus Emre YüceDecember 8, 2025 at 7:14 AM

Tags

Discussions

No Discussion Added Yet

Start discussion for "Prime Numbers" article

View Discussions

Contents

  • History and Fundamental Concepts

  • Distribution of Prime Numbers

    • Prime Number Theorem

    • Riemann Zeta Function and Riemann Hypothesis

  • Special Types of Prime Numbers

  • Primality Tests

  • Applications in Cryptology

  • New Methods and Unsolved Problems

Ask to Küre