MCPcopy Create free account
hub / github.com/subbarayudu-j/TheAlgorithms-Python / numberOfDivisors

Function numberOfDivisors

maths/basic_maths.py:19–35  ·  view source on GitHub ↗
(n)

Source from the content-addressed store, hash-verified

17 return pf
18
19def numberOfDivisors(n):
20 div = 1
21
22 temp = 1
23 while n % 2 == 0:
24 temp += 1
25 n = int(n / 2)
26 div = div * (temp)
27
28 for i in range(3, int(math.sqrt(n))+1, 2):
29 temp = 1
30 while n % i == 0:
31 temp += 1
32 n = int(n / i)
33 div = div * (temp)
34
35 return div
36
37def sumOfDivisors(n):
38 s = 1

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected