Skip to content

Instantly share code, notes, and snippets.

@jondavidjohn
Created February 20, 2012 15:54
Show Gist options
  • Save jondavidjohn/1869816 to your computer and use it in GitHub Desktop.
Save jondavidjohn/1869816 to your computer and use it in GitHub Desktop.
Get Factors of a number
def _facs(num):
rv = [1, num]
for i in xrange(2, int(math.sqrt(num)) + 1):
if not num % i:
rv.extend([i,num/i])
return rv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment