Python/maths/PrimeCheck.py

14 lines
301 B
Python
Raw Normal View History

2018-10-28 11:23:56 +00:00
import math
def primeCheck(number):
if number % 2 == 0 and number > 2:
2018-10-28 11:23:56 +00:00
return False
return all(number % i for i in range(3, int(math.sqrt(number)) + 1, 2))
def main():
print(primeCheck(37))
print(primeCheck(100))
print(primeCheck(77))
if __name__ == '__main__':
main()