Skip to content

Instantly share code, notes, and snippets.

@crowell
Created November 14, 2012 17:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save crowell/4073600 to your computer and use it in GitHub Desktop.
Save crowell/4073600 to your computer and use it in GitHub Desktop.
hw4p1b
import math
import fractions
N = 1791144786733299256875903974696580801523488563758757235898102851290189765401005609588035532773568199
e = 3
def gcd_iter(u, v):
while v:
u, v = v, u % v
return abs(u)
#dont need this one anymore
def getA(maxi):
a = 2
for b in range(1, maxi):
a = a**b
return a
def findP(maxi, N):
for a in range(2, 300):
x = a
for ii in range(1, maxi):
a = a**ii
print "."
if(gcd_iter(a-1, N) != 1):
print x
print gcd_iter(a-1, N)
return gcd_iter(a-1, N) #this is P!
findP(9, N)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment