How to find prime numbers? How to check if a number is prime.

Enumeration of divisors. By definition, number n is prime only if it is not evenly divisible by 2 and other integers except 1 and itself. The above formula removes unnecessary steps and saves time: for example, after checking whether a number is divisible by 3, there is no need to check whether it is divisible by 9.

  • The floor(x) function rounds x to the nearest integer that is less than or equal to x.

Learn about modular arithmetic. The operation is "x mod y" (mod is short for Latin word"modulo" means "divide x by y and find the remainder." In other words, in modular arithmetic, upon reaching a certain value, which is called module, the numbers “turn” to zero again. For example, a clock keeps time with a modulus of 12: it shows 10, 11 and 12 o'clock and then returns to 1.

  • Many calculators have a mod key. The end of this section shows how to manually evaluate this function for large numbers.
  • Learn about the pitfalls of Fermat's Little Theorem. All numbers for which the test conditions are not met are composite, but the remaining numbers are only probably are classified as simple. If you want to avoid incorrect results, look for n in the list of "Carmichael numbers" (composite numbers that satisfy this test) and "pseudo-prime Fermat numbers" (these numbers meet the test conditions only for some values a).

    If convenient, use the Miller-Rabin test. Although this method quite cumbersome when calculating manually, it is often used in computer programs. It provides acceptable speed and gives less mistakes than Fermat's method. A composite number will not be accepted as a prime number if calculations are made for more than ¼ of the values a. If you randomly select different meanings a and for all of them the test will give a positive result, we can assume with a fairly high degree of confidence that n is a prime number.

  • For large numbers, use modular arithmetic. If you do not have a calculator with a mod function at hand or the calculator is not designed for operations with such large numbers, use properties of powers and modular arithmetic to make calculations easier. Below is an example for 3 50 (\displaystyle 3^(50)) mod 50:

    • Rewrite the expression in a more convenient form: mod 50. When doing manual calculations, further simplifications may be necessary.
    • (3 25 ∗ 3 25) (\displaystyle (3^(25)*3^(25))) mod 50 = mod 50 mod 50) mod 50. Here we took into account the property of modular multiplication.
    • 3 25 (\displaystyle 3^(25)) mod 50 = 43.
    • (3 25 (\displaystyle (3^(25)) mod 50 ∗ 3 25 (\displaystyle *3^(25)) mod 50) mod 50 = (43 ∗ 43) (\displaystyle (43*43)) mod 50.
    • = 1849 (\displaystyle =1849) mod 50.
    • = 49 (\displaystyle =49).
  • October 5, 2016 at 2:58 pm

    The beauty of numbers. Antiprimes

    • Popular Science

    The number 60 has twelve divisors: 1, 2, 3, 4, 5, 6, 10, 12, 15, 20, 30, 60

    Everyone knows about amazing properties prime numbers that are divisible only by themselves and one. These numbers are extremely useful. Relatively large prime numbers (from about 10,300) are used in cryptography with open with a key, in hash tables, for generating pseudo-random numbers, etc. Except great benefit for human civilization, these special The numbers are amazingly beautiful:

    2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199...

    All other natural numbers greater than one that are not prime are called composite. They have several divisors. So, among the composite numbers, a special group of numbers stands out, which can be called “supercomposite” or “antiprime”, because they have especially many divisors. Such numbers are almost always redundant (except 2 and 4).

    A positive integer N whose sum of its own divisors (except N) exceeds N is called redundant.

    For example, the number 12 has six divisors: 1, 2, 3, 4, 6, 12.

    This is an excessive number because

    1 + 2 + 3 + 4 + 6 = 16 (16 > 12)

    It is not surprising that it is the number 12 that is used in a huge number practical areas, starting with religion: 12 gods in the Greek pantheon and the same number in the pantheon Scandinavian gods, not counting Odin, 12 disciples of Christ, 12 steps of the wheel of Buddhist samsara, 12 imams in Islam, etc. The duodecimal number system is one of the most convenient in practice, so it is used in the calendar to divide the year into 12 months and 4 seasons, as well as to divide day and night into 12 hours. A day consists of 2 clockwise circles in a circle divided into 12 segments; By the way, the number of 60 minutes was also chosen for a reason - this is another anti-prime number with a large number of divisors.

    A convenient duodecimal system is used in several monetary systems, including in the ancient Russian principalities (12 polushki = 1 altyn = 2 ryazanka = 3 novgorodki = 4 Tver money = 6 moskovki). As you can see, a large number of divisors is critical important quality in conditions where coins are from different systems must be reduced to one denomination.

    Large redundant numbers are useful in other areas. For example, let's take the number 5040. This is in some sense a unique number, here are the first from the list of its divisors:

    1, 2, 3, 4, 5, 6, 7, 8, 9, 10...

    That is, the number 5040 is divisible by all prime numbers from 1 to 10. In other words, if we take a group of 5040 people or objects, then we can divide it by 2, 3, 4, 5, 6, 7, 8, 9 or 10 equal groups. This is just a great number. Here full list 5040 dividers:
    1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 15, 16, 18, 20, 21, 24, 28, 30, 35, 36, 40, 42, 45, 48, 56, 60, 63, 70, 72, 80, 84, 90, 105, 112, 120, 126, 140, 144, 168, 180, 210, 240, 252, 280, 315, 336, 360, 420, 504, 560, 630, 720, 840, 1008, 1260, 1680, 2520, 5040

    Heck, we can divide this number by almost anything. Him 60 dividers!

    5040 is an ideal number for urban studies, politics, sociology, etc. The Athenian thinker Plato drew attention to this 2300 years ago. In his seminal work, The Laws, Plato wrote that an ideal aristocratic republic would have 5,040 citizens, because that number of citizens could be divided into any number of equal groups, up to ten, without exception. Accordingly, in such a system it is convenient to plan a managerial and representative hierarchy.

    Of course, this is idealism and utopia, but using the number 5040 is actually extremely convenient. If a city has 5,040 residents, then it is convenient to divide it into equal districts, plan a certain number of service facilities for an equal number of citizens, and elect representative bodies by voting.

    Such highly complex, extremely redundant numbers are called “antiprime”. If we want to give a clear definition, then we can say that an antiprime number is a positive integer that has more factors than any integer less than it.

    By this definition, the smallest antiprime number other than one will be 2 (two divisors), 4 (three divisors). The following are:

    6 (four divisors), 12 (six divisors), 24, 36, 48, 60 (the number of minutes in an hour), 120, 180, 240, 360 (the number of degrees in a circle), 720, 840, 1260, 1680, 2520, 5040, 7560, 10080, 15120, 20160, 25200, 27720, 45360, 50400

    It is these numbers that are convenient to use in board games with cards, chips, money, etc. For example, they allow you to distribute the same number of cards, chips, money different quantities players. For the same reason, they are convenient to use to compile classes of schoolchildren or students - for example, to divide them into equal amount identical groups to complete tasks. For the number of players in a sports team. For the number of teams in the league. For the number of residents in the city (as mentioned above). For administrative units in a city, region, country.

    As can be seen from the examples, many of the antiprimes are already de facto used in practical devices and number systems. For example, the numbers 60 and 360. This was quite predictable, given the convenience of having large quantities dividers.

    The beauty of antiprimes can be debated. While prime numbers are undeniably beautiful, anti-prime numbers may seem disgusting to some. But this is a superficial impression. Let's look at them from the other side. After all, the foundation of these numbers are prime numbers. It is from prime numbers, as if from building blocks, that composite numbers, redundant numbers and the crown of creation are made - antiprime numbers.

    The Fundamental Theorem of Arithmetic states that any composite number can be represented as the product of several prime factors. For example,

    30 = 2 × 3 × 5
    550 = 2 × 5 2 × 11,

    In this case, the composite number will not be divisible by any other prime number except its prime factors. Antiprime numbers, by definition, are distinguished by the maximum product of the powers of the prime factors of which they are composed.
    Moreover, their prime factors are always sequential prime numbers. And the powers in the series of prime factors never increase.

    So antiprimes also have their own special beauty.

    Numbers are different: natural, rational, rational, integer and fractional, positive and negative, complex and prime, odd and even, real, etc. From this article you can find out what prime numbers are.

    What numbers are called “simple” in English?

    Very often, schoolchildren do not know how to answer one of the most simple questions in mathematics at first glance, about what a prime number is. They often confuse prime numbers with natural numbers (that is, the numbers that people use when counting objects, while in some sources they begin with zero, and in others with one). But it's completely two different concepts. Prime numbers- these are natural, that is, integer and positive numbers that are greater than one and which have only 2 natural divisors. Moreover, one of these divisors is the given number, and the second is one. For example, three is a prime number because it cannot be divided without a remainder by any number other than itself and one.

    Composite numbers

    The opposite of prime numbers is composite numbers. They are also natural, also greater than one, but have not two, but a larger number of divisors. So, for example, the numbers 4, 6, 8, 9, etc. are natural, composite, but not prime numbers. As you can see, these are mostly even numbers, but not all. But “two” is an even number and the “first number” in a series of prime numbers.

    Subsequence

    To construct a series of prime numbers, it is necessary to select from all natural numbers, taking into account their definition, that is, you need to act by contradiction. It is necessary to consider each of the natural positive numbers to see if it has more than two divisors. Let's try to build a series (sequence) that consists of prime numbers. The list starts with two, followed by three, since it is only divisible by itself and one. Consider the number four. Does it have divisors other than four and one? Yes, that number is 2. So four is not a prime number. Five is also prime (it is not divisible by any other number, except 1 and 5), but six is ​​divisible. And in general, if you follow all the even numbers, you will notice that except for “two”, none of them are prime. From this we conclude that even numbers, except two, are not prime. Another discovery: all numbers divisible by three, except the three itself, whether even or odd, are also not prime (6, 9, 12, 15, 18, 21, 24, 27, etc.). The same applies to numbers that are divisible by five and seven. All their multitude is also not simple. Let's summarize. So, simple single-digit numbers include all odd numbers except one and nine, and even “two” are even numbers. The tens themselves (10, 20,... 40, etc.) are not simple. Two-digit, three-digit, etc. prime numbers can be determined based on the above principles: if they have no divisors other than themselves and one.

    Theories about the properties of prime numbers

    There is a science that studies the properties of integers, including prime numbers. This is a branch of mathematics called higher. In addition to the properties of integers, she also deals with algebraic and transcendental numbers, as well as functions of various origins related to the arithmetic of these numbers. In these studies, in addition to elementary and algebraic methods, analytical and geometric are also used. Specifically, “Number Theory” deals with the study of prime numbers.

    Prime numbers are the “building blocks” of natural numbers

    In arithmetic there is a theorem called the fundamental theorem. According to it, any natural number, except one, can be represented as a product, the factors of which are prime numbers, and the order of the factors is unique, which means that the method of representation is unique. It's called decomposition natural number into prime factors. There is another name for this process - factorization of numbers. Based on this, prime numbers can be called “ building material”, “blocks” for constructing natural numbers.

    Search for prime numbers. Simplicity tests

    Many scientists from different times tried to find some principles (systems) for finding a list of prime numbers. Science knows systems called the Atkin sieve, the Sundartham sieve, and the Eratosthenes sieve. However, they do not produce any significant results, and a simple test is used to find the prime numbers. Mathematicians also created algorithms. They are usually called primality tests. For example, there is a test developed by Rabin and Miller. It is used by cryptographers. There is also the Kayal-Agrawal-Sasquena test. However, despite sufficient accuracy, it is very difficult to calculate, which reduces its practical significance.

    Does the set of prime numbers have a limit?

    The ancient Greek scientist Euclid wrote in his book “Elements” that the set of primes is infinity. He said this: “Let's imagine for a moment that prime numbers have a limit. Then let's multiply them with each other, and add one to the product. The number resulting from these simple actions, cannot be divided by any of a number of prime numbers, because the remainder will always be one. This means that there is some other number that is not yet included in the list of prime numbers. Therefore, our assumption is not true, and this set cannot have a limit. Besides Euclid's proof, there is a more modern formula given by the eighteenth-century Swiss mathematician Leonhard Euler. According to it, the sum reciprocal of the sum of the first n numbers grows unlimitedly as the number n increases. And here is the formula of the theorem regarding the distribution of prime numbers: (n) grows as n/ln (n).

    What is the largest prime number?

    The same Leonard Euler was able to find the largest prime number of his time. This is 2 31 - 1 = 2147483647. However, by 2013, another most accurate largest in the list of prime numbers was calculated - 2 57885161 - 1. It is called the Mersenne number. It contains about 17 million decimal digits. As you can see, the number found by an eighteenth-century scientist is several times smaller than this. It should have been so, because Euler carried out this calculation manually, but our contemporary was probably helped by Calculating machine. Moreover, this number was obtained at the Faculty of Mathematics in one of the American departments. Numbers named after this scientist pass the Luc-Lemaire primality test. However, science does not want to stop there. The Electronic Frontier Foundation, which was founded in 1990 in the United States of America (EFF), has offered a monetary reward for finding large prime numbers. And if until 2013 the prize was awarded to those scientists who would find them from among 1 and 10 million decimal numbers, then today this figure has reached from 100 million to 1 billion. The prizes range from 150 to 250 thousand US dollars.

    Names of special prime numbers

    Those numbers that were found thanks to algorithms created by certain scientists and passed the simplicity test are called special. Here are some of them:

    1. Merssen.

    4. Cullen.

    6. Mills et al.

    The simplicity of these numbers, named after the above scientists, is established using the following tests:

    1. Luc-Lemaire.

    2. Pepina.

    3. Riesel.

    4. Billhart - Lemaire - Selfridge and others.

    Modern science does not stop there, and probably in the near future the world will learn the names of those who were able to receive the $250,000 prize by finding the largest prime number.

      I think it can. this is the sum of the numbers 2 and 3. 2+3=5. 5 is the same prime number. It is divided into itself and 1.

      No matter how strange it may seem, two prime numbers in sum may well give another prime number. It would seem that when adding two odd numbers, the result should be even and thus no longer odd, but who said that a prime number is necessarily odd? Let's not forget that prime numbers also include the number 2, which is divisible only by itself and one. And then it turns out that if there is a difference of 2 between two adjacent prime numbers, then by adding another prime number 2 to the smaller prime number, we get the larger prime number of this pair. Examples in front of you:

      There are other pairs that are easy to find in the table of prime numbers using the described method.

      You can find prime numbers using the table below. Knowing the definition of what is called a prime number, you can select a sum of prime numbers that will also give a prime number. That is, the final digit (prime number) will be divided into itself and the number one. For example, two plus three equals five. These three digits come first in the table of prime numbers.

      Sum of two prime numbers may be a prime number only under one condition: if one term is a prime number greater than two, and the other is necessarily equal to the number two.

      Of course, the answer to this question would be negative if it weren’t for the ubiquitous two, which, as it turns out, is also a prime number. But it falls under the rule of prime numbers: it is divisible by 1 and by itself. And because of not, the answer the question becomes positive. The set of prime numbers and twos of dates are also prime numbers. Otherwise, all the others would add up to an even number, which (except 2) are not prime numbers. So with 2, we get a whole series of also prime numbers.

      Starting from 2+3=5.

      And as can be seen from the tables of prime numbers given in the literature, such a sum cannot always be obtained with the help of two and a prime number, but only by obeying some law.

      A prime number is a number that can only be divided by itself and one. When looking for prime numbers, we immediately look at odd numbers, but not all of them are prime. The only prime even number is two.

      So, using a table of prime numbers, you can try to create examples:

      2+17=19, etc.

      As we see, all prime numbers are odd, and to obtain an odd number in the sum, the terms must be even + odd. It turns out that to get the sum of two prime numbers into a prime number, you need to add the prime number to 2.

      First, you need to remember that prime numbers are numbers that can only be divided by one and by itself without a remainder. If a number has, in addition to these two divisors, other divisors that do not leave a remainder, then it is no longer a prime number. Number 2 is also a prime number. The sum of two prime numbers can of course be a prime number. Even if you take 2 + 3, 5 is a prime number.

      Before answering such a question, you need to think, and not answer right away. Since many people forget that there is one even number, yet it is prime. This is the number 2. And thanks to it, the answer to the author’s question: yes!, this is quite possible, and there are quite a lot of examples of this. For example 2+3=5, 311+2=313.

      Prime numbers are those that are divisible by themselves and by one.

      I am attaching a table with prime numbers up to 997

      all these numbers are divisible by only two numbers - themselves and one, there is no third divisor.

      for example, the number 9 is no longer prime, since it has other divisors besides 1 and 9, this is 3

      Now we find the sum of two prime numbers so that the result is also prime, it will be easier to do this with a table:

      From school course we know mathematics. that the sum of two prime numbers can also be a prime number. For example 5+2=7, etc. A prime number is a number that can be divisible by itself or by no number one. That is, there are quite a lot of such numbers and their total sum can also give a prime number.

      Yes maybe. If you know exactly what a prime number is, then it can be determined quite easily. The number of divisors of a prime number is strictly limited - it is only one and this number itself, i.e., to answer this question, it will be enough to look at the table of prime numbers - apparently, one of the terms in this sum must necessarily be the number 2. Example: 41 + 2 = 43.

      First, let's remember what a prime number is - it's a number that can be divided by the same number and by one. And now we answer the question - yes, it can. But only in one case, when one term is any prime number, and the other term is 2.

      Considering that a prime number can be divided by itself, by the same number and by 1.

      Yes, it can. A simple example: 2+3=5 or 2+5=7

      and 5 and 7 are divisible by themselves and by 1.

      Everything is very simple if you remember your school years.

    All natural numbers, except one, are divided into prime and composite. A prime number is a natural number that has only two divisors: one and itself. All others are called composite. The properties of prime numbers are studied by a special branch of mathematics - number theory. In ring theory, prime numbers are related to irreducible elements.

    Here is a sequence of prime numbers starting from 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, ... etc.

    According to the fundamental theorem of arithmetic, every natural number that is greater than one can be represented as a product of prime numbers. At the same time, this is the only way to represent natural numbers up to the order of the factors. Based on this, we can say that prime numbers are the elementary parts of natural numbers.

    This representation of a natural number is called decomposition of a natural number into prime numbers or factorization of a number.

    One of the most ancient and effective ways The calculation of prime numbers is the “sieve of Erasstophenes”.

    Practice has shown that after calculating prime numbers using the sieve of Erastophenes, it is necessary to check whether the given number is prime. For this purpose, special tests have been developed, the so-called simplicity tests. The algorithm of these tests is probabilistic. They are most often used in cryptography.

    By the way, for some classes of numbers there are specialized effective primality tests. For example, to check the primality of Mersenne numbers, the Luc-Lehmer test is used, and to check the primality of Fermat numbers, the Pepin test is used.

    We all know that there are infinitely many numbers. The question rightly arises: how many prime numbers are there then? There are also an infinite number of prime numbers. The most ancient proof of this proposition is Euclid's proof, which is set out in the Elements. Euclid's proof looks like this:

    Let's imagine that the number of prime numbers is finite. Let's multiply them and add one. The resulting number cannot be divided by any of the finite set of prime numbers, because the remainder of division by any of them gives one. Thus, the number must be divisible by some prime number not included in this set.

    The prime number distribution theorem states that the number of prime numbers less than n, denoted π(n), grows as n / ln(n).

    After thousands of years of studying prime numbers, the largest known prime number is 243112609 − 1. This number has 12,978,189 decimal digits and is the Mersenne prime number (M43112609). This discovery was made on August 23, 2008 at the Faculty of Mathematics at uCLA University as part of the distributed search for Mersenne prime numbers project GIMPS.

    Home distinctive feature Mersenne numbers is the presence of a highly effective Luc-Lemaire primality test. With its help, the Mersenne primes are, over a long period of time, the largest known primes.

    However, to this day, many questions regarding prime numbers have not received precise answers. At the 5th International Congress of Mathematics, Edmund Landau formulated the main problems in the field of prime numbers:

    Goldbach's problem or Landau's first problem is that it is necessary to prove or disprove that every even number greater than 2 can be represented as the sum of two primes, and every odd number greater than 5 can be represented as a sum three simple numbers.
    Landau's second problem requires finding an answer to the question: is the set of “prime twins” - prime numbers whose difference is 2 - infinite?
    Legendre's conjecture or Landau's third problem is: is it true that between n2 and (n + 1)2 there is always a prime number?
    Landau's fourth problem: is the set of prime numbers of the form n2 + 1 infinite?
    In addition to the above problems, there is the problem of determining the infinite number of prime numbers in many integer sequences such as the Fibonacci number, Fermat number, etc.