title: How to get all factors aka divisors of a number of range 10^18 given that I can do this task in upto 10^6 computations?
body: <p>I am facing problems in getting all factors of a number I have tried this code but this is giving me a certain TLE in competitive programming question.</p>
  
  <pre><code>for i in range(1,int(N**0.5)+1):
  if N%i==0:
      S.add(i)
      S.add(N//i)
  </code></pre>
  
  <p>I want to use SIEVE to access all factors. i dont want to find just the count but physically access them in in a list ! I wish someone could explain me how to use Sieve Of Erasthosenes in it</p>