[FIX] maths/PrimeCheck (#796) · silam/TheAlgorithmPython@36828b1 · GitHub
Skip to content

Commit 36828b1

Browse files
Julien00859poyea
authored andcommitted
[FIX] maths/PrimeCheck (TheAlgorithms#796)
Current implementation is buggy and hard to read. * Negative values were raising a TypeError due to `math.sqrt` * 1 was considered prime, it is not. * 2 was considered not prime, it is. The implementation has been corrected to fix the bugs and to enhance readability. A docstring has been added with the definition of a prime number. A complete test suite has been written, it tests the 10 first primes, a negative value, 0, 1 and some not prime numbers. closes TheAlgorithms#795
1 parent 56513cb commit 36828b1

1 file changed

Lines changed: 48 additions & 7 deletions

File tree

maths/PrimeCheck.py

Lines changed: 48 additions & 7 deletions

0 commit comments

Comments
 (0)