title: Calculating the first triangle number to have over 500 divisors in python
body: <p>I'm trying to solve the 12th problem on Project Euler. I can calculate the number that has over 500 divisors in almost 4 minutes. How can i make it faster? Here's the attempt;</p>
  
  <pre><code>import time
  
  def main():
      memo={0:0,1:1}
      i=2
      n=200
      while(1):
          if len(getD(getT(i)))&gt;n:
              break
          i+=1
      print(getT(i))
  
  #returns the nth triangle number
  def getT(n):
      if not n in memo:
          memo[n]=n+getT(n-1)
      return memo[n]
  
  #returns the list of the divisors
  def getD(n):
      divisors=[n]
      for i in xrange(1,int((n/2)+1)):
          if (n/float(i))%1==0:
              divisors.append(i)
      return divisors
  
  startTime=time.time()
  main()
  print(time.time()-startTime)
  </code></pre>