Since ancient times, prime numbers have piqued the interest of humans. Mathematicians are still looking for prime numbers with mystical properties. Euclid proposed the prime number theorem, which states that there is an infinite number of prime numbers. Do you know all of the prime numbers from 1 to 100? Have you checked to see if each number is divisible by smaller numbers?
Then you undoubtedly put in a lot of time and effort. A great scientist named Eratosthenes, who lived a few decades after Euclid, devised a clever method for determining all the prime numbers up to a given number. The Sieve of Eratosthenes is the name given to this method.
If you need to find prime numbers up to n, we will generate a list of all numbers from 2 to n. Starting with the smallest prime number, p = 2, we will remove from the list all multiples of 2 except 2. Assign the next value of p to a prime number greater than 2.
Introduction to Prime Numbers
Prime numbers are those that have only two factors: 1 and the number itself. Consider the number 5, which has only two factors (1 and 5). This indicates that it is a prime number. Consider the number 6, which has more than two factors, namely 1, 2, 3, and 6. As a result, 6 is not a prime number.
Using the number 1 as an example, we can see that it has only one factor. As a result, it cannot be a prime number because a prime number must have exactly two factors. This means that 1 is neither a prime nor a composite number; rather, it is a distinct number.
Prime Number Properties
Let’s discuss some of the most important properties of prime numbers:
- A prime number is defined as a whole number that is greater than one.
- A prime number has only two factors, that is – one and the number itself.
- There is only one even prime number, 2; there are no odd prime numbers.
- Any two prime numbers that are coprime to each other are always coprime.
- Every number can be expressed as the product of two prime numbers.
Prime Numbers vs Composite Numbers
A prime number is one that has exactly two factors and is greater than one, whereas a composite number has more than two factors. For example, the number 5 can only be factorised in one way: 1 5 (OR) 5 1. A prime number has only two factors, which are 1 and 5. We can now say that 5 is a prime number.
A composite number is one that is greater than one and contains more than two factors. For example, the number four can be factorised in a variety of ways. As a result, the factors of 4 are 1, 2, and 4. It consists of more than two factors. As a result, 4 is a composite number.
How to Identify Prime Numbers?
Perform divisibility tests in the following order (from easiest to hardest) when determining whether a number is prime or composite: 2, 5, 3, 11, 7, and 13. If a number is divisible by one of these numbers, you know it’s a composite number and don’t need to perform the remaining tests. Here’s how you’ll know which tests to run:
- If a number less than 121 is not divisible by two, three, five, or seven, it is prime; otherwise, it is composite.
- If a number less than 289 isn’t divisible by two, three, five, seven, eleven, or thirteen, it’s prime; otherwise, it’s composite.
- Do keep in mind that 2 is the only even prime number. The next three odd numbers — 3, 5, and 7 — are prime.
To know more about prime numbers and how to easily identify them, you can visit Cuemath to learn more about the topic in a fun way!