title: How to calculate smallest number with certain number of divisors?
body: <p>From <a href="https://projecteuler.net/problem=500" rel="noreferrer">Project Euler problem 500</a></p>
  
  <blockquote>
    <p>The number of divisors of 120 is 16. In fact 120 is the smallest number having 16 divisors.</p>
    
    <p>Find the smallest number with 2**500500 divisors. Give your answer modulo 500500507.</p>
  </blockquote>
  
  <p>It's simple enough to count the divisors of n, eg. in Python <code>len([i for i in range(1,n+1) if n % i == 0])</code>. This is O(n).</p>
  
  <p>I tried brute force search and found the smallest number with 32 divisors is 840, but it's much too slow for the problem above. From the inequality <code>count_divisors(n) &lt;= n</code>, the number is going to be massive.</p>
  
  <p>What do you think? Any ideas? How to calculate smallest number with certain number of divisors?</p>
  
  <hr>
  
  <p><strong>Edit</strong>: I don't think this is a duplicate. This question is more specific, it concerns a particular class of <em>much</em> larger numbers. The <a href="https://stackoverflow.com/questions/8861994">other question</a> asks generally. Its answers aren't applicable to this problem, it's a different magnitude.</p>