def pminone(R,a,rounds):
b = a - 1
for j in range(1,rounds+1):
b= (ZZ(power_mod(b+1,j,R))-1) %R
p = gcd(b,R)
if p==R:
print("Pollard p-1 attack fails")
return None
elif p>1:
print("Discovered in round {0}".format(j))
return p
print ("Not found in {0}".format(rounds))
return None