Quantum Computing, Quantum, Quantum Physics, Shors Algorithm, Qiskit.
for factors are gcd(x^{r/2} ±1 , 15) guesses = [gcd(a**(r//2)-1, N), gcd(a**(r//2)+1, N)] print(f"Guessed Factors: {guesses[0]} and {guesses[1]}") for guess in guesses: if guess not in [1,N] and (N % guess) == 0: # Guess is a factor! print("*** Non-trivial factor found: {guess} ***") FACTOR_FOUND =