what is wrong here I tried to use gcd function but it give me this error but when I used floor and sqrt functions from math it works without any errors
import math
from random import *
p=int(input("Enter p value"))
q=int(input("Enter q value"))
n=p*q
z=(p-1)*(q-1)
e=0
'''Select E Value'''
seed(1)
while(True):
Random_Value=randint(2,n)
if math.gcd(z,Random_Value)==1:
e=Random_Value
break
You can use the gcd
function from fractions
:
import fractions
print fractions.gcd(3, 6)
As khelwood said, the gcd
function was added to the math
module in Python 3.5 ( doc ).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.