Loading
/custom-emojis/emojis/contour-map.png
Templates
📚
Articles & Resources
📖
Guides & Support
🎖️
Bounty Program
🌵
CalcTree

What is a prime number?

A natural number greater than 1 is called prime if it has exactly two factors, i.e., if the number is divisible only by 1 and itself.
When a natural number is greater than 1 and isn't prime, it's called a composite number.

Prime Number Checker

Input


Num
:7

Output


Is prime?
:TRUE


Aside from 1, 2 and 3, all of the prime numbers can be found to be of the forms:

6n+1or6n16n + 1 \hspace{3cm}\text{or}\hspace{3cm}6n -1
Where:

n=1,2,3...n = 1, 2, 3...
💡 Note! This does not mean that every value these equations produce is a prime number. If a prime number exists, it will fit into either of these two equations.

If we take the values of n from 1 to 10, we can find the first 18 prime numbers:

5
7
2
11
13
3
17
19
4
23
25
5
29
31
6
35
37
7
41
43
8
47
49
9
53
55
As mentioned, a few numbers: 25, 35, 49, and 55 are not primes. The most bulletproof method of measuring the primality of a number involves dividing the given number by every integer until the value itself. If the result is not a fraction or is a whole number, it will have a common factor and thus not be a prime.

Example 1: If we select 15:


15/2
:7.50



15/3
:5.00

We can stop here, as 5 is a whole number. So 15 is not a prime number, as 5 is a common factor.

Example 2: If we select 7:


7/2
:3.50



7/5
:1.40



7/3
:2.33



7/6
:1.17



7/4
:1.75



All results are fractions, therefore, 7 is a prime number, as it has no common factors besides 1.
This prime is also shown in the table above, as each is 6n+1 or 6n-1.

Why do prime numbers matter?

Prime numbers are crucial in number theory because of the fundamental theorem of arithmetic: every natural number greater than 1 can be written uniquely as a product of primes (up to the order of multiplication). In other words, primes are the building blocks of all other natural numbers.
Prime numbers have diverse cryptography, computer science, and number theory applications. They are crucial for encryption algorithms like RSA, efficient data structures such as hash tables, and prime factorization algorithms. Their significance in these fields makes prime numbers indispensable in modern technology and mathematical exploration.