Commit Graph

4 Commits

Author SHA1 Message Date
Julien Castiaux
36828b106f [FIX] maths/PrimeCheck (#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 #795
2019-05-11 19:20:25 +08:00
dheerajreddymumma
1305e74b8a New modified Python code for Prime check 2018-10-28 17:02:27 +05:30
dheerajreddymumma
2040757751 Optimized prime check code in Python. 2018-10-28 16:53:56 +05:30
Alex Brown
b566055e4b Merge branch 'master' of https://github.com/TheAlgorithms/Python 2018-10-20 14:15:21 -05:00