Well,we all know what’s prime number,a whole number greater than 1 whose factors are either one or itself but in this blog I will be writing about Prime Number Sieves which refers to prime number generating algorithms.
Why should we care about them?
Most modern computer cryptography works by using the prime factors of large numbers. The large number that was used to encrypt a file can be publicly known and available, because the encryption works so only the prime factors of that large number can be used to decrypt it again. Though finding those factors is technically only a matter of time, it’s a matter of so much time that we say it cannot be done. A modern super-computer could chew on a 256-bit factorization problem for longer than the current age of the universe, and still not get the answer.
Primes are of the utmost importance to number theorists because they are the building blocks of whole numbers.They are important to the world because their odd mathematical properties make them perfect for our current uses. It’s possible that new mathematical strategies or new hardware like quantum computers could lead to quicker prime factorization of large numbers, which would effectively break modern encryption. When researching prime numbers, mathematicians are always being both prosaic and practical.
Jason Davies, a data visualization specialist and computer scientist, created a model to show a link between various primes . 
Different Prime Number Sieves
Sieve of Eratosthenes
Eratosthenes was a Greek mathematician, geographer, poet, astronomer, and music theorist yes,all of this in his life span of 80 years.He was responsible for finding one of the easiest methods for generating primes having a time complexity of O(n log log n) and space complexity of O(n)
Steps involved for generating primes less than or equal to the integer ‘N’:
1.Make a list of all the integers less than or equal to n (and greater than one)
2.Taking out the first number in the list say x(i.e 2,initially) strike out all the multiples of x where x<=N in the list(when a number is striked it no longer belongs to the list) and x is added to the list of primes.
3.Repeat 2nd step for the next value of x till x<=N
4.The remaining elements of the list are the required prime numbers.
An Example where N is equal to 120 
Try writing a program using the above method.
Sieve of SP Sundaram
SP Sundaram was an Indian Mathematician of 1930’s who developed this method that uses Airithmetic sequences for generating primes.
Method
Start with 4 and create an arithmetic sequence by repeatedly adding three… 4, 7, 10, 13, 16, 19, 22… In the second row, start with seven, and add five each time 7, 12, 17, 22, 27,…. continue starting with each number in the first sequence as the initial term, and to each sequence add the next consecutive odd number…
It looks like this
4 7 10 13 16 19 22 25 28
7 12 17 22 27 32 37 42 47
10 17 24 31 38 45 52 59 66
13 22 31 40 49 58 67 76 85
16 27 38 49 60 71 82 93 104
You may observe that the numbers in the first row are the same as in the first column and so are the numbers in second row and second column and so on.
Clearly in this matrix some numbers are prime and others are not. Now if we apply the formula:
p = 2*x + 1,where x ∉ the Matrix and x < 104(largest number of the sequence),we get ‘p’ which is always a prime number although there may be repetitions.
The largest number in the sequence being 104 thus by the above explanation we may concude that we can generate prime numbers that are less than or equal to 209.
Algorithm
printPrimes(n) [Prints all prime numbers smaller than n]
1) In general Sieve of Sundaram, produces primes smaller than (2*x + 2) for a number given number x. Since we want primes smaller than n, we reduce n-2 to half. We call it nNew. nNew = (n-2)/2;
For example, if n = 102, then nNew = 50.
2) Create an array marked[n] that is going to be used to separate numbers of the form i+j+2ij from others where 1 <= i <= j
3) Initialize all entries of marked[] as false.
4) // Mark all numbers of the form i + j + 2ij as true // where 1 <= i <= j Loop for i=1 to nNew a) j = i; b) Loop While (i + j + 2ij) <= nNew (i) primes[i + j + 2ij] = true; (ii) j++
5) If n > 2, then print 2 as first prime.
6) Remaining primes are of the form 2i + 1 where i is index of NOT marked numbers. So print 2i + 1 for all i such that marked[i] is false.