Closed
Description
https://github.com/TheAlgorithms/Python/blob/master/maths/basic_maths.py
Function number_of_divisors(n) returns wrong results, e.g., number_of_divisors(6) produces 2. Correct answer should be 4.
After factorization, if n is not 1, this means it's a prime which has two divisors, thus the result should be multiplied by 2.
Solution: add the following code before function returns (line 60),
if n > 1: div *= 2
Metadata
Metadata
Assignees
Labels
No labels