Python/maths/PrimeCheck.py

14 lines
281 B
Python
Raw Normal View History

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