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