Beautiful anomalies are found in every subject, but if there is one area of beauty that most mathematicians would agree with, it is the prime number:

These numbers occupy a unique pedestal in mathematics, especially in the field of number theory. Great minds have spent countless hours investigating this problem, including great minds like Paul Erdos, G.H. Hardy, and Srinivasa Ramanujan, to name a few. Now, before we delve into various algorithms to find prime numbers, let’s first establish a preliminary understanding of prime numbers.

What are prime numbers?

The most technical definition of prime numbers is that it is a natural number greater than 1 and can only be obtained by multiplying 1 and itself. If our understanding of natural numbers were more intuitive, we could say that they are the numbers we use to count.

To understand this more accurately, let’s choose two numbers, 5 and 6. Now 5 is a number that can only be obtained by multiplying by 1 and 5 (the number itself). However, when we take the number 6, we notice that it can be obtained in a way other than by multiplying 1 and 6 (the number itself). It can also be obtained by multiplying the numbers 2 and 3, which means that it is not a prime number. A number that is not prime is known as a composite number.

The Maren Mersenne method

The Mersenne prime number method is a special method of finding a certain kind of prime number, known as Mersenne prime numbers: The name for this method comes from the French monk Marin Mersenne, who first defined it. Mersenne’s prime numbers are those that are reducible to the form 2n-1, where n is a prime number. The first few numbers in this method are 2, 3, 5, 7, 13, 17, 19, 31, 61, and 89. For a long time, Mersenne’s method of prime numbers was a hard work, because it was very time consuming when going to higher prime numbers.

However, with the advent of computers, they could now do these computational calculations that used to be done by humans in the most laborious and time-consuming way. We have definitely reached higher Mersenne prime numbers and prime numbers on a general level. The search for prime numbers is as active as other numerical searches performed by computers. Another numerical search, similar to the prime numbers movement, involves adding decimal places to some irrational numbers, such as pi (the ratio of the length of a circle to its diameter). However, the continuous search for the next largest prime number is significantly more difficult than the search for the next digit of pi.

Even the largest computers (supercomputers) spend a considerable amount of time to check whether a new number (which is usually staggeringly huge) is itself a prime number, and it takes even longer to check whether the number is a prime Mersenne number. For this reason, Mersenne numbers are of great interest in cybersecurity and cryptography, especially with regard to encryption.

In August 2008, UCLA systems administrator Edson Smith found the most significant prime number known at the time: Smith installed software for Great Internet Mersenne Prime Search (Gimps), a voluntary distributed computing project. That number was a Mersenne prime number 12,978,189 digits long. To give you an idea of how big it is, it would take almost two and a half months to write, and if printed, it would stretch 50 km!

Fermat’s method of prime numbers

Fermat’s number, like Mersenne’s number, is a special kind of prime number. The name comes from 17th century mathematician and lawyer Pierre de Fermat. Fermat’s number is similar to Mersenne’s number… with one small correction. Let’s take Fermat’s number Fm, where we can define Fm as 2m +1. Here m again equals 2, taken to the power of n or 2n.

Fermat was firmly convinced that all numbers of the above form are prime numbers. He went on to say that he would produce prime numbers for all integer values of m. What makes these numbers unique and beautiful, but very tricky, is that the prime numbers become extremely large very quickly, even within the first four iterations. To prove this, let’s take n as the following values, n=0, 1, 2, 3 and 4.

When n = 0, m = 20 = 1; therefore F0 = 2 1 + 1 = 2 + 1 = 3, which is simple. When n = 1, m = 21 = 2; therefore F1 = 22 + 1 = 4 + 1 = 5, which is prime. When n = 2, m = 22 = 4; hence F2 = 24 + 1 = 16 + 1 = 17, which is prime. When n = 3, m = 23 = 8; hence, F3 = 28 + 1 = 256 + 1 = 257, which is prime. When n = 4, m = 24 = 16; therefore, F4 = 216 + 1 = 65536 + 1 = 65537, which is a prime number. Now, as you can see, by the time we reach F5, the value reaches 4,294,967,297.

To date, we have only reached F11, even with all the best computers and parallel computing and great accuracy. In the end, however, we can say that the search for prime numbers will always go to infinity and beyond!