Skip to content

Commit

Permalink
clean code
Browse files Browse the repository at this point in the history
Reduce no of loops because not any number is divisible by more than its half
  • Loading branch information
16ratneshkumar authored Jul 23, 2024
1 parent ce7e2fb commit de6e85c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Prime_number.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def is_prime_b(n):
if n == 2:
return True
else:
for i in range(2, n):
for i in range(2, int(n//2)+1):
if n % i == 0:
return False
return True
Expand Down

0 comments on commit de6e85c

Please sign in to comment.