MCPcopy Create free account
hub / github.com/TheAlgorithms/Python / count_divisors

Function count_divisors

project_euler/problem_012/sol1.py:26–38  ·  view source on GitHub ↗
(n)

Source from the content-addressed store, hash-verified

24
25
26def count_divisors(n):
27 n_divisors = 1
28 i = 2
29 while i * i <= n:
30 multiplicity = 0
31 while n % i == 0:
32 n //= i
33 multiplicity += 1
34 n_divisors *= multiplicity + 1
35 i += 1
36 if n > 1:
37 n_divisors *= 2
38 return n_divisors
39
40
41def solution():

Callers 1

solutionFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected