title: Python - Fastest way to find all perfect squares in a given large number range
body: <p>I am trying to write a method to <strong>get all the perfect squares in a given range in Python</strong>. A large range like between 2621163 and 520001400002. Now obviously iterating through the range and checking if a number is perfect like so </p>
  
  <pre><code>def is_square(n):
      return math.sqrt(n).is_integer()
  </code></pre>
  
  <p>and then printing it is stupid for large ranges (works great for small ranges) and will take forever. I am wondering if there is any Python magic or mathemagic (say a modified Diophantine equation) that I can leverage for this purpose.</p>
  
  <p><strong>EDIT:</strong> Also I am using Python 3.X so I can use large integers.</p>