What is best way to find prime numbers in a range?

I was having difficulty in finding an efficient algorithm for finding prime numbers in a range. Please help me with this.

https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes
Check the gif on the right side. Its the exact way how sieve works.

@kgecadmin Try Eratosthenes sieve. The general idea is in the range you want, first remove all the numbers divisible by 2, then all those which are divisible by 3, and so on, and you will be left with prime numbers. Geeksforgeeks (http://www.geeksforgeeks.org/sieveoferatosthenes/) I believe provides a excellent practical implementation of the algorithm. For a mathematical proof, you can refer to https://math.stackexchange.com/questions/1509787/isthisproofoftheeratosthenessievecorrect