Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download
Views: 124
def pminone(R,a,rounds): ### R is the modulus, a is a random number and rounds is the number of rounds b = a - 1 #debug = 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 #if debug<100: # debug+=1 # print b print "Not found in {0}".format(rounds) return None
n = 15056208191 pminone(n,37462,3463)
Discovered on round 3463 34631