Skip to content

Commit

Permalink
Merge pull request keon#66 from mathagician/issue-56
Browse files Browse the repository at this point in the history
keon#58 | Correct the logic of Prime testing function in math/test_primt.py
  • Loading branch information
keon authored May 14, 2017
2 parents 238e68b + 5055f2d commit c8c2f99
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions math/prime_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ def prime_test(n):
return True
if n%2==0 or n%3==0:
return False
j = 6
while((j-1)*(j-1) <= n):
if n%(j-1)==0 or n%(j+1)==0:
j = 5
while(j*j <= n):
if n%(j)==0 or n%(j+2)==0:
return False
j += 6
return True

0 comments on commit c8c2f99

Please sign in to comment.