Quantum Fourier Transform, Quantum Phase Estimation, Shors Algorithm, Quantum Computing, Qiskit.
[gcd(a**(r//2)-1, N), gcd(a**(r//2)+1, N)] #Step 5. For each guess in guesses, check if at least one is a non-trivial factor # i.e. (guess != 1 or N) and (N % guess == 0) for guess in guesses: if (guess != 1 or N) and (N % guess == 0): break_out_flag = 1 break if break_out_flag == 1: break #Step 6.