Ad
Code
Diff
  • from math import sqrt
    
    def prime(x):
        end = min(int(sqrt(x) + 1), x)
        return all(x % i != 0 for i in range(2, end))
    • from math import sqrt
    • def prime(x):
    • counter = 0
    • for i in range(1,x):
    • if x % i is 0:
    • counter += 1
    • if counter is 0:
    • return True
    • else:
    • return False
    • end = min(int(sqrt(x) + 1), x)
    • return all(x % i != 0 for i in range(2, end))