a guest Apr 24th, 2019 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from math import sqrt
  2. def factor(n):
  3.       factors = set()
  4.       for x in range(1, int(sqrt(n)) + 1):
  5.         if n % x == 0:
  6.           factors.add(x)
  7.           factors.add(n//x)
  8.       return sorted(factors)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand