Created
November 14, 2012 17:44
-
-
Save crowell/4073600 to your computer and use it in GitHub Desktop.
hw4p1b
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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