Guest User

Untitled

a guest
Apr 18th, 2018
88
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def facCount(num):
  2. summ = 0
  3. for i in range(1, int(sqrt(num)) + 1):
  4. if num % i == 0:
  5. summ += 1
  6. summ *= 2
  7. if int(sqrt(num)) ** 2 == num:
  8. summ -= 1
  9. return summ
  10.  
  11.  
  12. from math import sqrt
  13.  
  14.  
  15. def count_factors(num):
  16. sum_ = 2 * sum(num % i == 0 for i in range(1, int(sqrt(num)) + 1))
  17. if int(sqrt(num)) ** 2 == num:
  18. sum_ -= 1
  19. return sum_
  20.  
  21.  
  22. check = 34243243244534
  23.  
  24. import time
  25.  
  26. start = time.clock()
  27. print(facCount(check))
  28. print(time.clock() - start)
  29.  
  30. start = time.clock()
  31. print(count_factors(check))
  32. print(time.clock() - start)
RAW Paste Data