Anonymous ID: 12909e Jan. 25, 2018, 8:47 a.m. No.3339   🗄️.is 🔗kun   >>3340 >>3341 >>3345 >>3353

>>3330

def factor(number):

C = number

A = 1

B = C

D = int(math.sqrt(C))

#print(D)

E = C - D*D

X = D - A

N = int((X*X+E)//2)

 

newX = E%2

newD = int((newX*(newX+2)+E)/2)

newA = newD - newX

while(gcd(newD-D,newA) == 1):

newX += 2

newD = int((newX*(newX+2)+E)/2)

newA = newD - newX

 

newA = D - newX

 

return newA

 

Here is my code for this. I've noticed that if you set D=1, then returned value is the negative factor of C (so with real D you get factor a, but with D=1 you get factor -a), so you don't even really need to calculate D, but it's here anyway. I can't factor RSA because (int((newX*(newX+2)+E)/2)) is too large for a float and it won't divide but I'm very confident that this works. I've tested it for some products of 2 primes (like 4 digits) and it has worked every time.