def smallPrimes(self,n="n",upperlimit=1000000):
if(n=="n"): n = self.modulus
from sympy import sieve
for i in sieve.primerange(1,upperlimit):
if(n % i == 0):
self.p = i
self.q = n // i
return
#-----------------END SMALL PRIME SECTION-----------------#
#----------------BEGIN POLLARDS P-1 SECTION---------------#
#Pollard P minus 1 factoring, using the algorithm as described by
# https://math.berkeley.edu/~sagrawal/su14_math55/notes_pollard.pdf
# Then I further modified it by using the standard "B" as the limit, and only
# taking a to the power of a prime. Then from looking at wikipedia and such,
# I took the gcd out of the loop, and put it at the end.
# TODO Update this to official wikipedia definition, once I find an explanation of
# Wikipedia definition. (I.e. Why it works)
评论列表
文章目录