Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def find_divisors(num):
- simple = [2,3,5,7]
- working = [num]
- new = []
- final = [1,num]
- count = 0
- while True:
- added = False
- count += 1
- for x in working:
- count += 1
- simple_div = [z for z in simple if x % z == 0]
- count += 5
- for y in simple_div:
- count += 1
- n = x / y
- new.append(n)
- for n in set(new):
- count += 1
- if n not in final:
- final.append(int(n))
- added = True
- working = list(map(int,set(new)))
- new = []
- if added is False:
- return list(sorted(final)),count
- print(find_divisors(250))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement