Any number can be called a prime number, if it is a natural number greater than 1 and has exactly two divisors, which is 1 and the number itself.

There are infinite number of prime numbers, and hence it not possible to list all of

them.

Also there isn’t any particular formula, to find represent all the prime numbers.

Many methods has been developed through out the years to find the prime numbers.

One of such method is called the

**Sieve of Eratosthenes**.

Lets check how the method is performed.

Take a set of natural numbers from 1 to n.

For example, lets take numbers from 1 to 50

First list them out

1 |
2 | 3 |
4 | 5 | 6 |
7 |
8 |
9 |
10 |

11 | 12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |

21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 |

31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 |

41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 |

As 1 is not a prime number, lets start with 2.

Avoiding that by circling it, and highlight the multiples of 2, up to the last number, which is 50 here.

1 | $\left (2 \right )$ | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 |

Next, take the number 3.

Circle it, and again highlight the multiples of 3,up to 50 .

1 | $\left (2 \right )$ | $\left (3 \right )$ | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 |

The next number that is not crossed is 5.

So circle it and highlight out all multiples of 5

1 | $\left (2 \right )$ | $\left (3 \right )$ | 4 | $\left (5 \right )$ | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 |

Repeat this process until there exists no number crossed out or circled.

Then the circled number will be all the prime numbers between 1 to 50

This method can be extended to as many numbers as we wish.

Also, its not necessary to check with all the numbers, but we need to check only up to the square root of the upper limit taken since any composite number given will have at least one factor which is less than the square root of the upper limit taken. . For example, here we need to check till $\sqrt{50}=7.07$ which is equivalent to 7.

So the list of prime numbers fro 1 to 50 is

2 |
3 |
5 |

7 | 11 | 13 |

17 |
19 |
23 |

29 |
31 |
37 |

41 |
43 | 47 |

The only defect of this method is that its time consuming as the upper limit increases.