Python icon indicating copy to clipboard operation
Python copied to clipboard

Function number_of_divisors(n) returns wrong results

Open yuanyanhui opened this issue 3 years ago • 8 comments

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

yuanyanhui avatar Feb 15 '22 09:02 yuanyanhui

Dear @yuanyanhui, Could you assign this issue to me? Thanks.

ramkishanteli2 avatar Feb 17 '22 18:02 ramkishanteli2

@ramkishanteli2 Seems only maintainers can assign issues.

yuanyanhui avatar Feb 18 '22 00:02 yuanyanhui

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Apr 25 '22 13:04 stale[bot]

This issues seems to have been resolved in commit 42a80cdaf689b03b326164862318039bd43bbff1 PR #6017.

Bjiornulf avatar Jul 14 '22 16:07 Bjiornulf

Has this issue been solved? If not, I would like to take this up.

debjit-bw avatar Oct 01 '22 10:10 debjit-bw

@debjit-bw as I said in the previous comment, I think this has been solved in the pointed commit (you can take a look by yourself). Sadly I don't think this issue gets much attention, and I doubt it will ever be closed...

Bjiornulf avatar Oct 01 '22 11:10 Bjiornulf

Oh sorry @Bjiornulf, I completely missed your earlier comment. Yeah this issue seems fixed. Thanks!

debjit-bw avatar Oct 01 '22 12:10 debjit-bw

Hello, Can you assign this issue to me?

nfarhaan avatar Oct 11 '22 21:10 nfarhaan