Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- s = 0
- r = n - 1
- while r & 1 == 0:
- s += 1
- r //= 2
- for _ in range(k):
- a = random.randrange(2, n)
- x = pow(a, r, n)
- if x != 1 and x != n - 1:
- j = 1
- while j < s and x != n - 1:
- x = pow(x, 2, n)
- if x == 1:
- break
- j += 1
- if x != n - 1:
- break
- flag = True
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement