We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f8e406a commit 90d7d13Copy full SHA for 90d7d13
brain_games/games/prime.py
@@ -4,12 +4,10 @@
4
5
6
def is_prime(number: int) -> bool:
7
- if number == 1:
+ if number < 2:
8
return False
9
- if number % 2 == 0:
10
- return number == 2
11
- square_root = int(number ** 0.5) + 1
12
- for divisor in range(3, square_root, 2):
+
+ for divisor in range(2, int(number ** 0.5) + 1):
13
if number % divisor == 0:
14
15
return True
0 commit comments