Advertisement
Guest User

Untitled

a guest
Oct 16th, 2019
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.19 KB | None | 0 0
  1. def factor(x):
  2.   divisors = []
  3.   p = 2
  4.   while p * p <= x:
  5.     while x % p == 0:
  6.       divisors.append(p)
  7.       x //= p
  8.     p += 1
  9.  
  10.   if x > 1:
  11.     divisors.append(x)
  12.   return divisors
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement