Closed
Description
def ShorsAlgorithm(N):
# Step 1: Initialize two auxiliary qubits a and b, such that N = 2^a * 2^b.
# Step 2: Perform a number of iterations of the following two-qubit procedure.
while True:
# Step 2.1: Perform the addition-subtraction method of modular arithmetic to obtain the period r of a^N.
# Step 2.2: Use the discrete logarithm to find a primitive root, g.
# Step 2.3: Apply the Gaussian elimination to obtain a non-singular linear combination of g and N.
# Step 2.4: Calculate the two partial factors, F1 and F2.
# Step 2.5: Apply a binary quadratic form (BQF) reduction to factor N further.
# If the remaining value of N is small, output the factors found.
if is_small(N):
return factorize(N)
Metadata
Metadata
Assignees
Labels
No labels