title: is Sieve of erathosthens the best algorithm to generate prime numbers from 1 to N?
body: <p>I was asked this question in an interview.
  I implemented an algorithm using sieve of eratosthenes concept and an array.</p>
  
  <p>Is there a better way to go about this question
  For those who dont know the sieve , here is the link:</p>
  
  <p><a href="http://en.wikipedia.org/wiki/Sieve_of_Eratosthenes" rel="nofollow">http://en.wikipedia.org/wiki/Sieve_of_Eratosthenes</a></p>
  
  <p>EDIT: Best in terms of both time and space complexity.
  I just told them the flaw of SoE is space complexity.
  So they asked me if I could do something about it .
  Here is how the interview went about:
  1) Implement a algo that prints prime numbers from 1 to n
  Ans: I implement using SoE
  2) Is this the best way to go about it
  Ans: ???</p>