Skip to content

Commit 238e68b

Browse files
authored
Merge pull request keon#65 from mathagician/master
keon#58 | Correct the logic of Prime testing function in math/test_prime.py
2 parents 76c50d6 + 04e6d46 commit 238e68b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

math/prime_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ def prime_test(n):
1111
if n%2==0 or n%3==0:
1212
return False
1313
j = 6
14-
while(j*j < n):
14+
while((j-1)*(j-1) <= n):
1515
if n%(j-1)==0 or n%(j+1)==0:
1616
return False
1717
j += 6
18-
return True
18+
return True

0 commit comments

Comments
 (0)