Look at the first time where they have a gcd that isn't one
>>3402
def getGCD(A, B):
if B == 0:
return A
else:
return getGCD(B, A % B)
def factor(number):
C = number
D = int(math.sqrt(C))#can be any number s.t. d^2 < C
E = C - D*D
newX = E%2
if(newX == 1):
dShift = 6
else:
dShift = 4
newD = int((newX*(newX+2)+E)//2)
newA = newD - newX
GCD = 1
dCand = newD - D
while(GCD == 1):
newX += 2
newD += dShift
dCand += dShift
dShift += 4
newA = newD - newX
GCD = getGCD(dCand, newA)
print(D-newX, GCD)
#return GCD
#newA = D - newX
#If we switch up the D value, one of these might be negative but it will still be a factor
return newA
This is all the Python code. I switched up the loop to make it fewer calculations but there may be a better way.
Yes
Also I've tested it for products of the first 50 primes and it solved them all