Open In App

Prime and Composite Numbers

Prime and Composite Numbers are commonly used classifications of Natural Numbers based on divisibility and the number of Factors. A Prime Number has only two factors while Composite Numbers have more than two factors. This classification of Numbers makes the study of natural numbers more organized and convenient and is useful in a variety of situations like computer algorithms, biology, understanding of Number Theory, etc.

This article describes what are prime and composite numbers, the types of primes and composite numbers, and tests to check whether a given number is prime or not (primality tests). Finally, a few solved questions, and a few practice problems related to prime and composite numbers are presented.



What are Prime and Composite Numbers?

Prime and Composite Numbers in Maths are classified on the basis of divisibility and the number of factors a number has. Let’s learn them in detail.



What are Prime Numbers?

Prime Numbers Definition

All the natural numbers greater than 1 that have only two factors one and the number itself are called Prime numbers.

In other words, a Natural Number n greater than 1 is prime if it has only two factors 1 and n.

Prime Numbers Examples

Some initial prime numbers in ascending order are

2, 3, 5, 7, 9, 11, 13, 17, 19, 23, . . .

All the above numbers have only two factors. They are only divisible by 1 and itself.

Note:

  • 1 is not a Prime Number because it has only factor 1 which is itself only.
  • 2 is the only even Prime Number.

Types of Prime Numbers

Note: A number that is divisible by 2 is known as an Even Number.

Note: A number that is not divisible by 2 is known as an Odd Number.

List of Prime Numbers

Prime Numbers from 1 to 100 are listed below:

List of Prime Numbers from 1 to 100

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.

Facts about Prime Numbers

  1. Infinite: There are infinitely many prime numbers. This fact was first proven by the ancient Greek mathematician Euclid around 300 BCE in his seminal work, “Elements.”
  2. Distribution: Prime numbers become less frequent as numbers increase, but they are still infinite in number and are distributed irregularly throughout the number line. This irregularity is captured by the Prime Number Theorem, which provides an asymptotic approximation of the distribution of prime numbers.
  3. Twin Primes: Twin primes are pairs of prime numbers that have a difference of 2 between them (e.g., 3 and 5, 11 and 13, 17 and 19). The existence of infinitely many twin primes is a famous unsolved problem in number theory known as the Twin Prime Conjecture.
  4. Role in Cryptography: Prime numbers play a central role in modern cryptography, particularly in algorithms like RSA encryption, where the security of the encryption relies on the difficulty of factoring large composite numbers into their prime factors.
  5. Mersenne Primes: Mersenne primes are prime numbers that can be expressed in the form 2p−1, where p is also a prime number. They have applications in number theory and have been extensively studied due to their intriguing properties.
  6. Goldbach Conjecture: The Goldbach Conjecture, proposed by the German mathematician Christian Goldbach in 1742, states that every even integer greater than 2 can be expressed as the sum of two prime numbers. Despite extensive computational verification for vast ranges of numbers, the conjecture remains unproven.
  7. Historical Significance: The study of prime numbers has a rich historical significance, dating back to ancient civilizations such as Greece and Egypt. Prime numbers have been studied for their mathematical properties and have practical applications in various fields, including cryptography, number theory, and computer science.

What are Composite Numbers?

Composite Numbers Definition

All natural numbers that can be expressed as a product of at least two smaller natural numbers are known as composite numbers.

In other words, a natural number that has at least one factor other than 1 and the number itself is called a composite number.

Composite Numbers Examples

Some initial composite numbers in ascending order are:

4, 6, 8, 9, 10, 12, 14, 15, 16, 18, 20,…

Notice that each of these have factor(s) between 1 and the number itself. Like 4 has 2, 6 has 2 & 3 and so on.

Note: All the natural numbers that are not 1 and not prime are composite numbers.

Types of Composite Numbers

List of Composite Numbers

Composite Numbers from 1 to 100 are listed below:

List of Composite Numbers from 1 to 100

4, 6, 8, 9, 10, 12, 14, 15, 16, 18, 20, 21, 22, 24, 25, 26, 27, 28, 30, 32, 33, 34, 35, 36, 38, 39, 40, 42, 44, 45, 46, 48, 49, 50, 51, 52, 54, 55, 56, 57, 58, 60, 62, 63, 64, 65, 66, 68, 69, 70, 72, 74, 75, 76, 77, 78, 80, 81, 82, 84, 85, 86, 87, 88, 90, 91, 92, 93, 94, 95, 96, 98, 99, & 100

Facts about Composite Numbers

  1. Product of Primes: Every composite number can be expressed as a unique product of prime numbers, known as its prime factorization. This property is a fundamental concept in number theory and plays a crucial role in various mathematical applications, including cryptography.
  2. Abundance or Excess: Composite numbers often exhibit an interesting property known as abundance or excess. The abundance of a composite number is the difference between the sum of its proper divisors and the number itself. Abundant numbers have an abundance greater than the number itself, while deficient numbers have an abundance less than the number.
  3. Distribution: Composite numbers are abundant in the set of natural numbers. As numbers increase, the proportion of composite numbers to prime numbers also increases significantly.
  4. Divisibility Tests: Many divisibility tests, such as those for 2, 3, 4, 5, 6, 8, 9, and 10, can determine if a number is composite without performing actual division. These tests rely on the properties of composite numbers and their divisibility patterns.
  5. Role in Cryptography: Composite numbers play a crucial role in modern cryptography, particularly in RSA encryption, where the security of the algorithm depends on the difficulty of factoring large composite numbers into their prime factors.
  6. Square Numbers: Many composite numbers are also square numbers, meaning they can be expressed as the square of an integer. Square composite numbers have multiple prime factors that are repeated in their prime factorization.
  7. Composite Ciphers: In cryptography, composite numbers are used in the creation of composite ciphers, which employ multiple encryption algorithms or keys to enhance security and resist attacks.
  8. Historical Significance: Throughout history, the study of composite numbers has contributed to the development of various mathematical concepts, algorithms, and encryption techniques, making them essential in both theoretical and practical domains of mathematics and computer science.

Fundamental Theorem of Arithmetic

Every integer larger than one can be uniquely expressed as a product of prime numbers, according to the fundamental theorem of arithmetic. It is sometimes referred to as the prime factorization theorem and the unique factorization theorem.

Every integer bigger than one is either a prime number or can be written as a product of primes, according to the theorem. For instance, 35 = 7 × 5 can be expressed as the product of its prime factors.
Carl Friedrich Gauss proved the theorem in 1801.

Prime and Composite Numbers Chart

A prime and composite numbers chart is a table that lists all the numbers from 1 to 100 and identifies them as either prime or composite. Here is the prime and composite numbers chart

How to Find if a Number is Prime or Composite?

To determine whether a given number is prime or composite, you can follow these methods:

Trial Division Method

Example: Let’s determine if n=17 is prime or composite:

Sieve of Eratosthenes

Example: Let’s determine if n=29 is prime or composite using the Sieve of Eratosthenes:

Fermat’s Little Theorem

This method is usually used for large numbers, especially in cryptography.

These methods provide efficient ways to determine whether a given number is prime or composite, depending on the size of the number and the available computational resources.

HCF and LCM of Prime and Composite Numbers

HCF refers to the Highest Common Factor. It refers to the largest divisor which is common to given set of numbers. LCM refers to the Lowest Common Multiple is the lowest multiple which is common to a given set of numbers.

HCF of a Set of Prime Numbers

The Highest Common Factor (HCF), also known as the Greatest Common Divisor (GCD), of a set of prime numbers is indeed 1. This property stems from the definition of prime numbers and the fundamental theorem of arithmetic.

Prime numbers are integers greater than 1 that have no positive divisors other than 1 and themselves. Therefore, any two distinct prime numbers have no common factors other than 1 because they cannot be divided evenly by any integer other than 1 and themselves.

When we consider a set of prime numbers, each prime number within the set maintains this property of having no factors other than 1 and itself. As a result, when we look for the highest common factor among them, the only number that evenly divides all of them is 1.

So, the HCF of a set of prime numbers is always 1 due to the unique properties of prime numbers and their inability to be divided by anything other than 1 and themselves.

LCM of a Set of Prime Numbers

The Lowest Common Multiple (LCM) of a set of prime numbers is indeed equal to the product of all distinct numbers from the set. This is a fundamental property that arises from the nature of prime numbers and the definition of LCM.

Since prime numbers are by definition indivisible by any other positive integer except 1 and themselves, when we consider the LCM of a set of prime numbers, each prime number contributes uniquely to the overall product.

When finding the LCM of a set of prime numbers, we essentially look for the smallest multiple that is divisible by all the numbers in the set. Since prime numbers have no common factors except 1, the LCM is simply the product of all the distinct prime numbers in the set.

For example, let’s consider a set of prime numbers: {2, 3, 5}. The LCM of these prime numbers is calculated as:

LCM (2, 3, 5) = 2 * 3 * 5 = 30

In this case, the LCM is indeed equal to the product of the distinct prime numbers in the set, which is 30.

This property holds true for any set of prime numbers, as each prime number contributes uniquely to the LCM without any need for adjustment due to common factors. Therefore, the LCM of a set of prime numbers is equal to the product of all distinct numbers from the set.

HCF & LCM of Composite Numbers

HCF & LCM of Composite Numbers can be find out using Prime Factorization and Division Method.

Prime Factorization of Composite Numbers

Every composite number can be expressed as a product of prime numbers. The process of writing a natural number (other than 1 because it has no prime factors) as a product of prime numbers is known as Prime Factorization and the prime numbers present in it are known as prime factors of the number.

Refer to solved examples 3 and 4 for example.

Note: The prime factorization of a prime number is just the number itself.

Difference between Prime and Composite Numbers

Following table lists five differences between a prime and composite number:

Prime vs Composite Numbers

Prime Numbers Composite Numbers
All the natural numbers greater than 1 that have only two factors – one and the number itself are called prime numbers. All natural numbers that can be expressed as a product of at least two smaller natural numbers are known as composite numbers.
Prime numbers have exactly two factors – 1 and the number itself. Composite numbers have at least 3 or more factors.
All the prime numbers except 2 are odd numbers. There is no such pattern for composite numbers. They can be odd and even both.
Their prime factorization has only one prime factor i.e., the number itself. Their prime factorization can have one or more prime factors.
Examples: 2, 3, 5, 7, … Examples: 4, 6, 8, 9, 10, …

Tests for Prime and Composite numbers

A test or procedure to check whether a given natural number is prime or not is known as a Primality Test. A primality test can also be used to find whether a given natural number is composite or not with this simple idea: If the number is not prime and not 1, then it is composite.

Following subsections discuss some algorithms/procedures for primality tests and finding prime numbers.

Basic Primality Test

This is the easiest primality test. It is based on the fact that if a natural number n is prime, then there must be no factor between 1 and the number. Here it is

Given a natural number ‘n’

  • If n = 1, it is not prime (neither composite).
  • Else, try to divide n by each natural number between 1 and n. If a factor is found, then n is not prime (composite) else it is prime.

Efficient Primality Test

It is known that all the factors of a natural number n other than n are smaller than or equal to √n. So, we can make the basic primality test more efficient by just trying to find the factors from 1 to √n instead of 1 to n. Here is the algorithm/procedure

Given a Natural Number ‘n’

  • If n = 1, it is not prime (neither composite).
  • Else, try to divide n by each natural number between 1 and √n. If a factor is found, then n is not prime (composite) else it is prime.

Note: This procedure is very fast compared to basic primality test. We only require a maximum of √n steps where basic primality test requires a maximum of n steps. For example, this procedure requires only 10 steps where the basic one requires 100 steps! The procedure becomes more and more beneficial as the size of n becomes larger.

Eratosthenes Sieve

This is an ancient algorithm/procedure for finding prime numbers. When we want to find all the prime numbers up to a certain limit n > 1, this is a convenient and very efficient algorithm. Here is the algorithm –

Step 1: List all the numbers from 2 to n.

Step 2: Circle the first uncrossed number and then cross all the multiples of the number.

Step 3: Repeat Step 2 until all the numbers in the list are either crossed or circled.

Step 4: Now the circled numbers are prime numbers, and the crossed ones are composite numbers.

Refer to solved question 9 for a demo of this procedure.

Solved Questions on Prime and Composite Numbers

Question 1: Find the HCF of 2, 3, 17.

2, 3 and 17 all are prime numbers therefore, their HCF is 1.

Question 2: Find the LCM of 2, 3, 3, 2, 5.

All the given numbers are prime.

Therefore, LCM = product of distinct numbers = 2 x 3 x 5 = 30

Question 3: Find the Prime Factors of 4.

Prime factorization of 4: 2 x 2

Therefore, there is one prime factor of 4 i.e., 2.

Question 4: Find the prime factors of 84.

Prime factorization of 84: 2 x 42 = 2 x (2 x 21) = 2 x 2 x (3 x 7) or 2 x 2 x 3 x 7

Therefore, the prime factors of 82 are: 2, 3 and 7.

Question 5: Check whether 7 is prime using basic primality test.

7 is not 1.

2 is not a factor of 7.

3 is not a factor of 7.

4 is not a factor of 7.

5 is not a factor of 7.

6 is not a factor of 7.

We conclude that there is no factor of 7 between 1 and 7, hence, 7 is a prime number.

Question 6: Check whether 9 is prime using basic primality test.

9 is not 1.

2 is not a factor of 9.

3 is a factor of 9.

We conclude that there is at least one factor of 9 between 1 and 9 i.e., 3. Hence, 9 is not prime (or 9 is composite).

Question 7: Check whether 7 is prime using efficient primality test.

7 is not 1.

√7 = 2.6…. so we check till natural numbers smaller than or equal to 2.6…

2 is not a factor of 7.

The next natural number 3 is greater than 2.6 … so we conclude that there is no factor of 7 between 1 and 7.

Hence, 7 is a prime number.

Note: A prime number is never a square number and vice-versa. Therefore, the instant we found that 9 has a natural number square root, we know that the square root is a factor between 1 and 9, hence, 9 is not prime. We just continued the above example to show the working of the algorithm.

Question 8: Check whether 9 is prime using efficient primality test.

9 is not 1.

√9 = 3 so we check till natural numbers smaller than or equal to 3.

2 is not a factor of 9.

3 is a factor of 9.

Since we found a factor of 9 greater than 1 and smaller than equal to , therefore 9 is not a prime number.

Question 9: Find all the prime numbers up to 20 using Eratosthenes Sieve.

Solution:

We have 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20

(2), 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20

(2), (3), 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20

(2), (3), 4, (5), 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20

(2), (3), 4, (5), 6, (7), 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20

(2), (3), 4, (5), 6, (7), 8, 9, 10, (11), 12, 13, 14, 15, 16, 17, 18, 19, 20

(2), (3), 4, (5), 6, (7), 8, 9, 10, (11), 12, (13), 14, 15, 16, 17, 18, 19, 20

(2), (3), 4, (5), 6, (7), 8, 9, 10, (11), 12, (13), 14, 15, 16, (17), 18, 19, 20

(2), (3), 4, (5), 6, (7), 8, 9, 10, (11), 12, (13), 14, 15, 16, (17), 18, (19), 20

Question 10: Find the prime factors of 13.

13 is a prime number, so, it is the one and only prime factor of itself.

Hence, answer is 13.

Practice Questions on Prime and Composite Numbers

Here are some practice questions/problems based on prime and composite numbers:

Q1. Is 1 a composite number?

Q2. Check whether 23 is a prime number.

Q3. Check whether 56 is a prime number.

Q4. Check whether 2779 is a prime number. (Hint: Use Efficient Primarility Test)

Q5. Use Eratosthenes sieve to find all the prime numbers from 1 to 100.

Q6. Find the prime factors of 69.

Related Articles

Number Theory

HCF and LCM Questions

Properties of Real Numbers

Arithmetic Operations

Long Division

Whole Numbers

Prime and Composite Numbers – FAQs

What is a Prime Number?

A prime number is a natural number having only two factors i.e. 1 and the number itself. For example, 2, 3, 5, 7, etc.

What is a Composite Number?

A composite number is a natural number greater than 1 that can be expressed as a product of two smaller natural numbers. For example, 4 = 2×2, 6 = 2×3), etc.

How many Prime Numbers are there?

There are infinitly many prime numbers. If we have n prime numbers, then, we can get a new prime number pn+1 given by where pi represents the ith prime number (like 2 is the 1st prime number, 3 is the second, 5 is the third one and so on).

Is 1 a Composite Number or Prime Number?

1 is neither a composite number nor a prime number. 1 cannot be written as a product of any two smaller natural numbers (since there are no natural numbers smaller than one) hence it is not composite. 1 does not have two distinct divisors hence it is not a prime number either.

Which is the Smallest Prime and Composite Numbers?

The Smallest Prime and Composite Number is 2 and 4 resepevctively

How to find if a given Natural Number is Prime or not?

Let the number be n. If n = 1, it is not prime. If n ≠1, if there is no factor of n greater than 1 and smaller than or equal to √n then n is a prime number else it is not a prime number.

What is Primality?

The property of a natural number of being prime is known as “primality”.

What are Coprime Numbers?

A pair of natural numbers whose HCF (highest common factor) is 1 are known as coprime numbers. For example, 2 & 3, 1 &2, 4 & 15, etc. A pair of prime numbers is always coprime. Also, a pair of consecutive numbers is always coprime like 5 & 6, 7 & 8, etc.

What are Twin Prime Numbers?

Twin primes are a pair of prime numbers that have a difference of 2 between them. For example, 3 & 5, 5 & 7, 11 & 13, etc.

What is a Primality Test?

A procedure to determine whether a given number is prime or not is known as a primality test.

How to determine whether a given Number is composite?

To determine whether a given number is composite, follow the simple rule: If a given natural number is neither 1 nor prime, then it is a composite number. If the number is not 1, then use a primality test to check whether its prime of not.


Article Tags :