Skip to content

Hmm #3319

Closed
Closed
Hmm#3319
@m7mdragab

Description

@m7mdragab

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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions