The Wayback Machine - https://web.archive.org/web/20250915200548/https://www.geeksforgeeks.org/maths/prime-numbers/
Open In App

Prime Numbers in Maths

Last Updated : 10 Sep, 2025
Comments
Improve
Suggest changes
Like Article
Like
Report

A prime number is a natural number greater than 1 and has exactly two positive divisors: 1 and itself. Numbers that have more than two divisors are called composite numbers

  • The number 1 is neither a prime nor composite.
  • All primes are odd, except for 2.

A total of 25 prime numbers are there between 1 to 100.
These are: 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.

Mathematically prime numbers are defined as:

Formally, a number 'p' is prime if:

  • p is a natural number (p ≥ 2).
  • p has no divisors other than 1 and p itself. That is, if p can be written as p = a × b, then a = 1 and b = p, or vice versa.

With this understanding of prime numbers, a common question that often arises is whether the number '1' qualifies as a prime number. Since the definition of a prime number specifies that it must have exactly two divisors—1 and the number itself—this leads us to an important distinction.

Prime Numbers vs Composite Numbers

Every number except for 1 is either prime or composite. Let's take a closer look at the fundamental differences between these two types of numbers.

Prime Numbers

Composite Numbers

All Prime Numbers have only two factors such as 1 and the number itself. All composite numbers must have any factor other than 1 and the number itself.
All Primes are Odd numbers except 2.Composites can be either odd or even.
First few primes are 2, 3, 5, 7, 11, 13, 17, etc.First few composites are 4, 6, 8, 9, 10, 12, 14, 15, etc.

Here is the difference between them defined through an image:

prime-factors
Prime vs Composite

Discover why 1 is neither prime nor composite: [Read Here]

Prime Numbers 1 to 100

There are 25 prime numbers between 1 to 100. The image added below shows the prime numbers from 1 to 100.

Prime-Numbers
List of Prime numbers between 1 to 100

Smallest and Largest Prime Number

  • The smallest prime number is 2. It is unique because it’s the only even prime number.
  • There is no largest prime number, as prime numbers continue infinitely.
    • The largest prime number discovered as of 2025 is (2136,279,841 – 1), which has 41,024,320 digits.

Properties of Prime Numbers

Prime numbers have some properties which are listed as follows:

  • A Prime number is always a natural number i.e., a number greater than 1.
  • There are infinitely many prime numbers. This was proved by Euclid around 300 BC.
  • Every positive integer greater than 1 can be written as a product of prime numbers uniquely, up to the order of the factors. This is known as the Fundamental Theorem of Arithmetic.

Prime Factorization

Prime factorization involves breaking down a composite number into a product of prime numbers. For example, the prime factorization of 60 is 22 x 3 x 5. This is useful for solving problems involving divisibility, greatest common divisors, and least common multiples.

Prime Factorization Example Table

Prime factorization of some of the common composite numbers are:

NumbersPrime Factorization

Numbers

Prime Factorization

3622 × 32

40

23 × 5

2423 × 3

50

2 × 52

6022 × 3 × 5

48

24 × 3

182 × 32

30

2 × 3 × 5

7223 × 32

42

2 × 3 × 7

4532 × 5

20

22 × 5

Curious about some interesting facts on Prime Factorization? Take a look at these [Read facts about Prime Factorization]!

Coprime Numbers

Coprime numbers have just a single common factor which is 1. This means that a pair of numbers is said to be coprime if their largest common factor is 1.

For example: 21 and 22:

  • 1, 3, 7, and 21 are the factors of 21.
  • 1, 2, 11, and 22 are the factors of 22.

Here, 21 and 22 only share a single common factor, which is 1. Since they are co-prime, their HCF equals 1.

Note: All primes numbers are coprime to each other.

How to Find Prime Numbers?

Let's learn some simple methods, which can help us easily identify that given number is a Prime or not.

  • All even numbers are NOT Prime, except for 2. This means if a number ends with 0, 2, 4, 6, or 8, it is not prime.
  • Prime Number can also be found by Divisibility Rules for Small Primes.
  • Division Method and Factorization Method are also used to find prime numbers.

There are other methods to find prime numbers to study them please refer to How to Find Prime Numbers?

Algorithms to Check for Prime

Since there is no formula to directly check whether a given number is prime or not, we typically use compute programs to check the same. There exist many algorithms to do the same. The best possible time we get for prime numbers is O(Log n) for a given number n if we have not done any preconceptions.

Please refer to Check for Prime Number for all programs and algorithms in detail.

Importance of Prime Numbers

Prime Numbers hold a significant place in the evolution of mathematics, primarily for their crucial role in improving cryptography and security standards in the modern world. Despite years of research, Prime Numbers continue to be an active topic in the field of mathematical research, fascinating scientists and scholars with their elegant properties and wide range of applications.

  • Prime numbers are the basic building blocks of natural numbers. Every integer greater than 1 can be uniquely expressed as a product of primes, known as the Fundamental Theorem of Arithmetic. This uniqueness is crucial for number theory.
  • Prime numbers play a vital role in modern cryptography, particularly in algorithms like RSA. They are used to create keys for secure data transmission, ensuring that sensitive information remains private.
  • Primes are central to many important theorems and conjectures in mathematics, such as the Goldbach Conjecture and the Prime Number Theorem, which describes the distribution of prime numbers among the integers.
  • In computer algorithms, prime numbers are used in hashing functions and data structures, helping to optimize performance and reduce collisions in hash tables.
  • Studying prime numbers contributes to the understanding of randomness and patterns in mathematics. Their distribution can reveal insights into more complex mathematical structures and theories.

Solved Examples of Prime Numbers

Example 1: Determine whether 37 is a prime number or not.

Solution: 

As a prime number is a positive integer greater than 1 that has no positive integer divisors other than 1 and itself.
As 37 = 1 × 37, 
Therefore, 37 has no divisors other than 1 and itself, and it is a prime number.
So, 37 is a prime number.

Example 2: Find all the prime numbers between 20 and 40.

Solution: 

The prime numbers between 20 and 40 are 23, 29, and 37.

Example 3: Is 19 a Prime Number?

Solution:

Let us write the given number in the form of 6n ± 1.
6(3) + 1 = 18 + 1 = 19
Therefore, 19 is a prime number

Example 4: Which is the greatest prime number between 1 to 10?

Solution:

There are 4 prime numbers between 1 and 10 and the greatest prime number between 1 and 10 is 7.

Example 5: Why is 20, not a prime number?

Solution:

The factors of 20 are 1, 2, 4, 5, 10, and 20. Thus, 20 has more than two factors. Since the number of factors of 20 is more than two numbers, it is NOT a prime number.

Practice Questions on Prime Numbers

Question 1. Find the first 5 prime numbers.

Question 2. Determine whether the following numbers are prime or not: 17, 25, 29, 37, 41.

Question 3. Calculate the product of the first 3 prime numbers.

Question 4. What is the sum of the first 10 prime numbers?

Question 5. Find the prime factorization of the number 56.

Question 6. Is 97 a prime number? Explain why or why not.

Question 7. What is the List of all prime numbers between 50 and 100?

Question 8. What is the prime factorization of 84?

Question 9. Find the sum of the prime numbers between 10 and 30.

Question 10. Identify the twin primes between 40 and 60 (twin primes are pairs of primes that differ by 2).

Answers

  1. 2, 3, 5, 7, 11
  2. Prime: 17, 29, 37, 41
    Not Prime: 25
  3. 30 (2 × 3 × 5)
  4. 129
  5. 23 × 7
  6. Yes, 97 is prime.
  7. 53, 59, 61, 67, 71, 73, 79, 83, 89
  8. 22 × 3 × 7
  9. 60 (11 + 13 + 17 + 19)
  10. 41 and 43, 59 and 61 (twin primes)

Also Check: Prime Numbers Worksheet

Prime Numbers for Programmers


Prime Numbers in Maths

Explore