Giter Club home page Giter Club logo

qiskit-shors's Introduction

Shor's Algorithm

Version 0.1

The implementation of a scalable instance of Shor's algorithm for factoring large integers using a combination of classical and quantum computing algorithms.

Motivation

The vision of this project is to lower the use barrier for physicists and industry domain experts to engage with quatum algorithms. The goal of this project is to develop a robust, transaprent, and scalable instance of Shor's algorithm, that will become accessible by integrating it into the native Qiskit Aqua repo.

Abstract

The proliferation of noisy intermediate-scale quantum (NISQ) devices has allowed interested individuals to discover and develop scalable applications of quantum computing (QC). The benefit of quantum computing posits that they can solve real-world problems more efficiently then classical computers. Shor's algorithm is a manifestation of QC's advantage over classical computers.

As of today, numerous research papers claim to have implemented Shor's algorithm on NISQ devices to the end of factoring composite integers. However, the methods do not reveal the content of the so-called quantum "black-boxes", which presumably contain the an optimized quantum circuit for factorization. Further investigation of current methods revealed that many implementations of Shor's algorithm rely on mapping classical circuits to quantum circuits, without using a single Hadamard gate, thus simply running a classical circuit on the NISQ.

In addition to the method detailed above, perform quantum factorization after the results is determined classically. With the correct result in mind, quantum gates are organized to return the binary of the desired factors, e.g. for n = p * q = 15: p = bin(3) = 11, q = bin(5) = 101. The unusual focus of many researchers on factoring numbers 15 and 21 caused a sequence of publications that reveals the fallacy of their approaches.

A wholly QC based approach to Shor's algorithm requires control of quantum mechanics, mathematics, quantum information, computation science, and high fidelity NISQ devices.

Thus, none of the papers known to the authors of this article as of today provide DIY instructions for Shor's algorithm.

Description

The algorithm factors a composite integer n by selecting random integers within the range 1 < a < n, then computes the factors of n by a using Euclid's algorithm. If the GCD(a,n) > 1, then {a,n} are co-prime numbers. The Algorithm proceeds with factorization via modular exponentiation function period finding. Once even period r is found, the function calculates the first factor p = a^r/2 - 1. the second factor can be found by the formula q = a^r/2 + 1, or dividing n by the first known factor p.

There is no known efficient algorithm of period finding using the modular exponentiation function on classical computers. However, period finding problem can be solved efficiently by QC. To solve the period finding problem on a QC, the existing problem is mapped to an equivalent quantum Fourier transform (QFT) problem that returns periods of a (mod n).

Algorithm

  1. Initialize composite integer n for factoring
  2. Select sample of (random) integers a
  3. Verify that {a,n} are co-prime numbers via Euclidean algorithm. If GCD(a,n) > 1, first factor p = GCD(a,n), second factor q = n/p.
  4. (a) Classical approach. If GCD(a,n) = 1, proceed with modular exponentiation period finding. Count set of unique remainders r = a^k (mod n) for each a in a sample, where order k -> 128, to avoid exceeding the range of int64. Compute period r.
  5. (b) Quantum approach - Estimate period r(a) by mapping the problem into QFT. Convert {a,n} into binary, construct the quantum circuit of n + 1 qubits, where additional qubit serves as the q-control for recycling the output of sequential circuits.
  6. If r is even, calculate factor p = a^r/2 - 1.
  7. Calculate second factor q = n/p
  8. (Optional) Check if p and q are prime by initializing them as the input n in the first stage of the algorithm.

Requirements

Python 3.x, numpy, matplotlib, qiskit-terra, qiskit-aer, qiskit-aqua

Contributions

The goal is to make Shor's algorithm accessible for everyone by integrating it into the native Qiskit Aqua. The project is under active development, contributions are welcome and highly appreciated.

Reference

  1. IBM Quantum Experience
  2. Shor's algorithm
  3. Qiskit

qiskit-shors's People

Contributors

wahorvat avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

qiskit-shors's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.