Loading [MathJax]/jax/output/CommonHTML/jax.js

Prime Numbers

What Are Prime Numbers?

A prime number is an integer greater than 1 that can only be divided by 1 and itself.

In other words, a prime number has exactly two distinct factors: 1 and itself.

Here are some examples of prime numbers:

2 , 3 , 5 , 7 , 11 , 13 , 17 , 19 , 23 , 29 , 31 ...

For instance, the number 7 has only two factors: 1 and 7.

7÷1=7

7÷7=1

Since no other numbers divide 7 evenly, it is a prime number.

Why isn't 1 considered a prime number? Because it has only one factor: itself. If 1 were classified as prime, the unique prime factorization of numbers would no longer hold, contradicting the fundamental theorem of arithmetic.

An Alternative Definition

Another way to define a prime number is:

An integer a is a prime number if, whenever it divides a product bc (where b and c are integers), it must also divide at least one of the factors. a|bca|ba|c

For example, let’s take a=3, a prime number, and check this property using a product bc.

If we choose b=6 and c=5, then bc=6×5=30.

Here, a=3 divides bc=30, and it also divides at least one of the factors (b=6), confirming the definition.

How many prime numbers are there? Infinitely many! This was first proven by Euclid. The largest known prime number, discovered in 2018, is 282,589,9331, which has over 24 million digits.

One of the most efficient ways to identify prime numbers up to N is the Sieve of Eratosthenes.

Prime Factorization

Any composite number can be expressed as a product of prime numbers.

Example

The number 30 is not prime.

Its prime factorization is:

30=235

Since 30 is divisible by 2, 3, and 5 (as well as by 1 and itself), it is not a prime number.

The Fundamental Theorem of Arithmetic

According to the fundamental theorem of arithmetic:

Every integer greater than 1 has a unique prime factorization, meaning it can be expressed as a product of distinct irreducible elements, each raised to a positive exponent ek>0. n=fe11fe22...fekk

For example, consider n=180.

Its prime factorization is:

180=223251

Here, 2, 3, and 5 are prime numbers, and their respective exponents e1=2, e2=2, and e3=1 are positive.

Thus, we can express n=180 as:

n=fe11fe22fe33=223251

The factorization is unique, except for the order of the factors.

180=223251

This confirms the fundamental theorem of arithmetic.

The same rule applies to any integer greater than 1.

Note: Changing the order of the factors does not affect the uniqueness of the factorization, as the prime factors remain the same. 180=223251=325122=512232

Prime Number Theorem

The ratio p(x)/(x/logx) approaches 1 as x grows indefinitely: limxp(x)xlogx=1 where x is a real number with x>0, and p(x) represents the number of prime numbers less than x.

In other words, the probability that a randomly chosen integer n is prime is approximately 1/logn.

Gauss was the first to observe that the distribution of prime numbers closely follows the function x/logx asymptotically.

Comparison of the prime number sequence and the function x/log x

This function, x/logx, provides a useful estimate of how many prime numbers exist below a given number n.

Example. Let’s estimate the number of primes below n=55 using Gauss’s formula: nlogn=55log55=13.72 The estimate suggests there are about 14 primes below 55. In reality, counting them gives 16, but the approximation is fairly accurate. This formula becomes increasingly useful for large values of n.

From this, we can approximate the probability that an integer n is prime:

1logn

This also implies that, on average, we would expect to check about logn numbers before finding a prime greater than n.

logn

Example. Suppose we want to find the next prime after n=43. log43=3.76 The estimate suggests we should find a prime in about 4 attempts. 44 (Attempt 1) 45 (Attempt 2) 46 (Attempt 3) 47 (Prime - Attempt 4)  As expected, the next prime, 47, was found in 4 steps. While this formula is only an approximation, it provides a reasonable expectation for the number of trials needed. This property is particularly valuable in cryptography.

Mersenne Prime Numbers

Mersenne numbers are integers of the form:

Mn=2n1

where n is a positive integer.

Not all Mersenne numbers are prime—only certain values of n produce a prime Mn.

For example:

- M2=221=3 (prime)
- M3=231=7 (prime)
- M4=241=15 (not prime)
- M5=251=31 (prime)

Mersenne numbers exhibit an interesting property: if Mn=2n1 is prime, then n must also be prime.

However, the converse is not necessarily true: just because n is prime does not guarantee that Mn is also prime. For instance, n=11 is prime, but M11=2111=2047, which is not prime (since 2047=23×89).

This property makes Mersenne numbers particularly useful in the search for large prime numbers.

Rather than testing 2n1 for every n, we only check values where n is prime, significantly reducing the number of computations.

Strategy for Finding Mersenne Primes

  1. Select a prime number n.
  2. Compute the corresponding Mersenne number Mn=2n1.
  3. Perform a primality test to determine whether Mn is actually prime.

This method has led to the discovery of the largest known prime numbers.

However, while limiting the search to prime values of n reduces the number of candidates, each Mn must still undergo a primality test, which remains computationally intensive.

Note. It’s worth emphasizing that not all prime numbers are Mersenne primes, and not all Mersenne numbers are prime.

Additional Notes

Here are a few additional insights on prime numbers:

And so on.

 
 

Please feel free to point out any errors or typos, or share suggestions to improve these notes. English isn't my first language, so if you notice any mistakes, let me know, and I'll be sure to fix them.

FacebookTwitterLinkedinLinkedin
knowledge base

Prime Numbers

FAQ