Skip to content

Instantly share code, notes, and snippets.

@Ayrx
Created July 11, 2013 12:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Ayrx/5975212 to your computer and use it in GitHub Desktop.
Save Ayrx/5975212 to your computer and use it in GitHub Desktop.
Factorization snippet
def factors(n):
return set(reduce(list.__add__,
([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment