Quantum Computing, Crypto, Quantum Physics, Cryptography, Education.
Fraction(phase).limit_denominator(15) # Denominator should (hopefully!) tell us r frac = Fraction(phase).limit_denominator(15) s, r = frac.numerator, frac.denominator print(r) guesses = [gcd(a**(r//2)-1, N), gcd(a**(r//2)+1, N)] print(guesses) a = 7 factor_found = False attempt = 0 while not