This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def miller_rabin(n, k=10): | |
if n == 2: | |
return True | |
if not n & 1: | |
return False | |
def check(a, s, d, n): | |
x = pow(a, d, n) | |
if x == 1: | |
return True |