/shor_algorithm

A repository about Shor's algorithm

Primary LanguageJupyter NotebookGNU General Public License v3.0GPL-3.0

Shor's algorithm

Description:

A implementation of Shor's algorithm that works for an arbitrary number.

How to use:

Installing requirements:

git clone https://github.com/jvscursulim/shor_algorithm

pip install -r requirements.txt

Code example:

Factoring number=15.

from shor import ShorAlgorithm

number = 15
num_qubits_qft = 2
shots = 8192

shor = ShorAlgorithm()

factors = shor.get_number_prime_factors(number=number, num_qubits_qft=num_qubits_qft, shots=shots)

print(factors)

Output: (3,5)

Quantum Circuit of code example:

image

References:

Qiskit Textbook - Shor's algorithm