from math import sqrt def prime(x): return sum([1 if x % i == 0 else 0 for i in range(2, min(int(sqrt(x) + 1), x))]) == 0
- 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))- return sum([1 if x % i == 0 else 0 for i in range(2, min(int(sqrt(x) + 1), x))]) == 0