14 lines
248 B
Python
14 lines
248 B
Python
# test fermata
|
|
import random
|
|
|
|
def fermat(k, p):
|
|
i = 0
|
|
while i < k:
|
|
a = random.randint(1, p - 1)
|
|
if pow(a, (p - 1), p) == 1:
|
|
i = i + 1
|
|
else:
|
|
return False
|
|
return True
|
|
|
|
print(fermat(10, 79)) |