title: Efficient python code for printing the product of divisors of a number
body: <p>I am trying to solve a problem involving printing the product of all divisors of a given number. The number of test cases is a number 1 &lt;= t &lt;= 300000 , and the number itself can range from 1 &lt;= n &lt;= 500000</p>
  
  <p>I wrote the following code, but it always exceeds the time limit of 2 seconds. Are there any ways to speed up the code ?</p>
  
  <pre><code>from math import sqrt
  
  def divisorsProduct(n):
      ProductOfDivisors=1
  
      for i in range(2,int(round(sqrt(n)))+1):
          if n%i==0: 
              ProductOfDivisors*=i
  
              if n/i != i:
                  ProductOfDivisors*=(n/i)    
  
      if ProductOfDivisors &lt;= 9999:
          print ProductOfDivisors
      else:
          result = str(ProductOfDivisors)
          print result[len(result)-4:] 
  
  T = int(raw_input())
  
  for i in range(1,T+1):
      num = int(raw_input())
      divisorsProduct(num)
  </code></pre>
  
  <p>Thank You.</p>