def primetest2(x): if x < 2 or (x > 2 and x % 2 == 0): return False d = 3 while d < x: if x % d == 0: return False d += 2 return True