title: Efficiently getting all divisors of a given number
body: <p>According to this <a href="https://stackoverflow.com/questions/11995069/finding-factors-of-a-number-not-getting-accurate-results">post</a>, we can get all divisors of a number through the following codes.</p>
  
  <pre><code>for (int i = 1; i &lt;= num; ++i){
      if (num % i == 0)
          cout &lt;&lt; i &lt;&lt; endl;
  }
  </code></pre>
  
  <p>For example, the divisors of number <code>24</code> are <code>1 2 3 4 6 8 12 24</code>.</p>
  
  <p>After searching some related posts, I did not find any good solutions. Is there any efficient way to accomplish this?</p>
  
  <p>My solution:</p>
  
  <ol>
  <li>Find all prime factors of the given number through this <a href="http://www.geeksforgeeks.org/print-all-prime-factors-of-a-given-number/" rel="noreferrer">solution</a>.</li>
  <li>Get all possible combinations of those prime factors.</li>
  </ol>
  
  <p>However, it doesn't seem to be a good one.</p>