arxiv: v2 [quant-ph] 1 Aug 2017

Similar documents
Log-mod-finding: A New Idea for Implementation of Shor's Algorithm

Shor s Prime Factorization Algorithm

Lecture note 8: Quantum Algorithms

Quantum algorithms for computing short discrete logarithms and factoring RSA integers

Shor s Algorithm. Elisa Bäumer, Jan-Grimo Sobez, Stefan Tessarini May 15, 2015

Qubit Recycling. Ran Chu. May 4, 2016

arxiv:quant-ph/ v3 21 Feb 2003

Measuring progress in Shor s factoring algorithm

QUANTUM PHASE ESTIMATION WITH ARBITRARY CONSTANT-PRECISION PHASE SHIFT OPERATORS

Figure 1: Circuit for Simon s Algorithm. The above circuit corresponds to the following sequence of transformations.

cse 311: foundations of computing Fall 2015 Lecture 12: Primes, GCD, applications

Shor Factorization Algorithm

arxiv:quant-ph/ v1 15 Jan 2006

Imitating quantum mechanics: Qubit-based model for simulation

Quantum Computation 650 Spring 2009 Lectures The World of Quantum Information. Quantum Information: fundamental principles

Logic gates. Quantum logic gates. α β 0 1 X = 1 0. Quantum NOT gate (X gate) Classical NOT gate NOT A. Matrix form representation

Short Course in Quantum Information Lecture 5

Deleting a marked state in quantum database in a duality computing mode

Classical RSA algorithm

Ph 219b/CS 219b. Exercises Due: Wednesday 4 December 2013

cse 311: foundations of computing Spring 2015 Lecture 12: Primes, GCD, applications

THE RESEARCH OF QUANTUM PHASE ESTIMATION

Basic elements of number theory

Basic elements of number theory

QUANTUM COMPUTING. Part II. Jean V. Bellissard. Georgia Institute of Technology & Institut Universitaire de France

Quantum algorithms (CO 781, Winter 2008) Prof. Andrew Childs, University of Waterloo LECTURE 1: Quantum circuits and the abelian QFT

Quantum Computation and Communication

Quantum algorithms for testing Boolean functions

Factoring integers with a quantum computer

CS483 Design and Analysis of Algorithms

Introduction to Quantum Information Processing QIC 710 / CS 768 / PH 767 / CO 681 / AM 871

arxiv:quant-ph/ v2 20 Dec 2010

Investigating the Complexity of Various Quantum Incrementer Circuits. Presented by: Carlos Manuel Torres Jr. Mentor: Dr.

Teleportation of Quantum States (1993; Bennett, Brassard, Crepeau, Jozsa, Peres, Wootters)

Simple Math: Cryptography

arxiv:quant-ph/ v5 6 Apr 2005

Discrete Mathematics GCD, LCM, RSA Algorithm

arxiv: v2 [quant-ph] 5 Dec 2013

arxiv:quant-ph/ v3 11 Mar 2004

Experimental Realization of Shor s Quantum Factoring Algorithm

A scheme for protecting one-qubit information against erasure. error. Abstract

Introduction to Quantum Information Processing QIC 710 / CS 768 / PH 767 / CO 681 / AM 871

New attacks on RSA with Moduli N = p r q

Factoring on a Quantum Computer

Ph 219b/CS 219b. Exercises Due: Wednesday 11 February 2009

Realization of Two-Qutrit Quantum Gates with Control Pulses

Solving Systems of Modular Equations in One Variable: How Many RSA-Encrypted Messages Does Eve Need to Know?

Quantum Arithmetic on Galois Fields

Phase estimation. p. 1/24

Quantum Computing ~ Algorithms. HIO) 0 HIO) 010) = ~(l000) ) ) ))

Probabilistic Teleportation of an Arbitrary Two-Qubit State via Positive Operator-Valued Measurement with Multi Parties

Quantum computing and quantum information KAIS GROUP

A VLSI Algorithm for Modular Multiplication/Division

A FAST QUANTUM CIRCUIT FOR ADDITION WITH FEW QUBITS

Lecture 14: Hardness Assumptions

Introduction to Quantum Computing

Gates for Adiabatic Quantum Computing

Shor s Algorithm. Polynomial-time Prime Factorization with Quantum Computing. Sourabh Kulkarni October 13th, 2017

Integers and Division

2 A Fourier Transform for Bivariate Functions

Circuits for Shor Factorization

Quantum Fourier Transforms

Quantum Error Correction Codes - From Qubit to Qudit

arxiv:quant-ph/ v1 16 Nov 1995

arxiv: v1 [quant-ph] 30 Aug 2011

Introduction to Cryptology. Lecture 20

arxiv:quant-ph/ Oct 2002

Arbitrary accuracy iterative quantum phase estimation algorithm using a single ancillary qubit: A two-qubit benchmark

Introduction to Quantum Computing

Asymmetric Cryptography

Chapter 4 Asymmetric Cryptography

Quantum search by local adiabatic evolution

arxiv:quant-ph/ v2 23 Aug 2003

The Deutsch-Josza Algorithm in NMR

NUMBER THEORY AND CODES. Álvaro Pelayo WUSTL

Numbers. Çetin Kaya Koç Winter / 18

A brief survey on quantum computing

Introduction to Quantum Algorithms Part I: Quantum Gates and Simon s Algorithm

A New Attack on RSA with Two or Three Decryption Exponents

Lecture notes: Algorithms for integers, polynomials (Thorsten Theobald)

arxiv:quant-ph/ v1 16 Jul 2003

QUANTUM COMPUTATION. Lecture notes. Ashley Montanaro, University of Bristol 1 Introduction 2

QFT, Period Finding & Shor s Algorithm

Advanced Cryptography Quantum Algorithms Christophe Petit

CPSC 467: Cryptography and Computer Security

Public Key Cryptography

PHYSICAL REVIEW A, 66,

University of Tokyo: Advanced Algorithms Summer Lecture 6 27 May. Let s keep in mind definitions from the previous lecture:

Introduction into Quantum Computations Alexei Ashikhmin Bell Labs

Lecture 5: Arithmetic Modulo m, Primes and Greatest Common Divisors Lecturer: Lale Özkahya

Lecture 18: Oct 15, 2014

Fast Fraction-Integer Method for Computing Multiplicative Inverse

A Gentle Introduction to Quantum Computing

Number Theory. Modular Arithmetic

Primality Testing. 1 Introduction. 2 Brief Chronology of Primality Testing. CS265/CME309, Fall Instructor: Gregory Valiant

The goal differs from prime factorization. Prime factorization would initialize all divisors to be prime numbers instead of integers*

Notes. Number Theory: Applications. Notes. Number Theory: Applications. Notes. Hash Functions I

Transformation of quantum states using uniformly controlled rotations

Quantum Computing Lecture Notes, Extra Chapter. Hidden Subgroup Problem

Encryption: The RSA Public Key Cipher

Transcription:

A quantum algorithm for greatest common divisor problem arxiv:1707.06430v2 [quant-ph] 1 Aug 2017 Wen Wang, 1 Xu Jiang, 1 Liang-Zhu Mu, 1, 2, 3, 4, and Heng Fan 1 School of Physics, Peking University, Beijing 100871, China 2 Institute of Physics, Chinese Academy of Sciences, Beijing 100190, China 3 School of Physical Sciences, University of Chinese Academy of Sciences, Beijing 100190, China 4 Collaborative Innovation Center of Quantum Matter, Beijing 100190, China (Dated: August 2, 2017) We present a quantum algorithm solving the greatest common divisor (GCD) problem. This quantum algorithm possesses similar computational complexity with classical algorithms, such as the well-known Euclidean algorithm for GCD. This algorithm is an application of the quantum algorithms for the hidden subgroup problems, the same as Shor factoring algorithm. Explicit quantum circuits realized by quantum gates for this quantum algorithm are provided. We also give a computer simulation of this quantum algorithm and present the expected outcomes for the corresponding quantum circuit. PACS numbers: 03.67.Ac, 03.67.Lx Introduction. The quantum algorithms may perform more quickly in solving certain problems than the classical ones for the same problems in classical computers. The most famous one is Shor algorithm[1], which may attack the existing cryptographic system involving Rivest- Shamir-Adleman (RSA) protocol[2]. The implementation of Shor algorithm in a quantum computer is still a tough task, however, great progresses have been made experimentally. A realization of factoring 15 into 3 and 5 using Shor algorithm was completed using room temperature liquid-state nuclear magnetic resonance techniques [3]. Recently, this task was also completed by using an ion-trap quantum computer [4]. Since the number of available qubits which can be controlled is limited, the Kitaev approach[5] to compress the implementation of Fourier Transform has been used, and controlled multipliers in the original algorithm is replaced with maps considering possible emergent states in the process of the algorithm. However, this process costs much larger computational complexity than classical algorithms, diminishing the advantage in implementing the Shor algorithm. Many others have also investigated circuits containing as few qubits as possible though involving more gates [6, 7]. An adiabatic quantum algorithm is proposed and implemented to solve the factoring problem, succeeding to use fewer qubits than standard Shor algorithm [8, 9]. Four photonic qubits are used to complete the factorization of = 15, coherently implementing the quantum circuits of the modular exponential execution and semiclassical quantum Fourier transformation [10]. In Shor algorithm, the true modular multipliers are necessary for the quantum advantage, though difficult to implement presently. However, we know that the modular addition may be realized more easily by current technology. An quantum algorithm constituted by modular addition as a key step will be of interest. Particularly, muliangzhu@pku.edu.cn hfan@iphy.ac.cn more effective quantum algorithms are in demand considering large-scale quantum computers may be available in the near future. In this Letter, we present this quantum algorithm to solve the GCD problem (greatest common divisor problem). Similar to the Shor algorithm, this algorithm can be considered as belonging to quantum algorithms for hidden subgroup problem [11, 12]. The computational complexity of our quantum algorithm is (log 2 (n)) 2. It shares similar time complexity with the classical algorithms for working out GCD. The existing classical algorithms include the well-known Euclidean algorithm [12, 13] and Stein algorithm [14]. The complexity of the latter is O((log 2 (n)) 2 ) and the complexity of the Euclidean algorithm is O((log 2 (n)) 3 ). We remark that our algorithm needs some efficient classical algorithm such as Stein algorithm to deal with the final result of the measurement, or it would need to iterate the algorithm for extra O(log 2 (n)) times to get the GCD. In that case, the complexity of our quantum algorithm would grow to O((log 2 (n)) 3 ). Shor factoring algorithm solves a problem that there does not exist a classical algorithm which can work out effectively. But for the GCD problem, the existing classical algorithms work efficiently enough. So our quantum algorithm would not give such advantages as Shor factoring algorithm, but comparable with the classical ones. However, this one is simpler than the Shor algorithm, even though their complexities are the same. So it can act as a test algorithm for quantum computers since it is a typical application of the quantum algorithms for the hidden subgroup problems. Mathematical foundation. In the GCD problem, our purpose is to obtain the greatest common divisor of two given natural numbers, say x and r. We can do it by looking for the least positive integers and k to establish the relationship x = rk = P in which P is an integer. At this point we know that P is the least common multiple of x and r and that r is the greatest common divisor of x and r. Our quantum algorithm is designed to obtain the number so that we obtain the r. To be specific, we will obtain an estimation of s in which s is a random

2 number satisfying 0 s ( 1) with enough sufficient accuracy by the end of the quantum procedure. Combining with some other classical calculation and repetition of the quantum procedure, we can obtain the final result r. We have two different methods to do this conversion from s to r and they are both discussed in the section Further processing. And after we obtain the r, the problem gets solved. Quantum procedure. We use the modular addition in our algorithm as the controlled unitary operator. (a)the circuit for the first two operations in the quantum procedure. U : y (x + y)modr (1) Here if we operate the state in r dimensional space, the operation modr could be satisfied automatically. If not, we use some quantum gates to do so. Then we claim that for any integer s 0, 1,..., 1, the state u s is the eigenstate of U. U u s = U( ymodr + e 2πi s 1 (x + y)modr +e 2πi s 2 (2x + y)modr +... +e 2πi s ( 1) (( 1)x + y)modr ) 1 = e 2πi s us (2) Here the parameters x, r, have already been defined previously. So we have found the eigenstate of U, and we can use the techniques of quantum phase estimation [11, 12] to obtain. The procedure is as follows, 0 t 0 (b)the implementation of the U 2i. Here we use the techniques of reversible computation[12]. FIG. 1. A practical method of implementation of the first two operations in the quantum procedure. one, which makes implementation easier. Let b be the estimation of s/ accurate to n bits and b = s b. We calculate p = b r 2 1. We know r/ is an integer. So we can say p/r = s/ only if b satisfies 2 t 2 t 1 j=0 j 0 apply Ht I r b 1 2 (4) 2 t 2 t 1 = 1 2 t 1 2 t j=0 j=0 j (jx)modr 1 s=0 j u s e 2πisj/ apply c U s= 1 s=0 s/ u s apply F + I Here y in the u s has been assigned as 0. And here we have used jx + y = a s e2πisj/ u s. This result can be easily obtained from Eq.(2). F is the quantum Fourier transform and F + is the inverse quantum Fourier transform. The definition of ψ is as follows, if ϕ u = 0.ϕ 1 ϕ 2 ϕ 3..., ϕ u = ϕ 1 ϕ 2 ϕ 3..., where ϕ i F 2 is the number on the i th position of the binary number ϕ u. According to the theory of the quantum phase estimation, if we choose t = n + log 2 (2 + 12ɛ ) (3) we can obtain an estimation of s/ accurate to n bits with a success rate of at least 1 ɛ. We may use the continued fractions algorithm[15] just like Shor algorithm to obtain the precise s/ from the estimation. In that case n needs to be at least 2L + 1. But because our problem is different, we are able to make n a smaller Considering r < 2 L when L = log 2 r, n only needs to satisfy n (L + 1). So compared with the least t = 2L + 1 + log 2 (2 + 1 2ɛ ) in Shor algorithm, this algorithm only needs t = L + 1 + log 2 (2 + 1 2ɛ ) and we could get the precise p/r = s/. Further processing. However, we only have obtained p/r = s/ the numerator and denominator of which may share a common factor. We still need to use other classical algorithms to simplify it to find a coprime ratio, for example, by using the Stein algorithm. Since we could directly use Stein algorithm to solve the whole problem, this quantum algorithm performs not as well as this classical one. We also know s and may share a common factor. Takeing this situation into account, we repeat the quantum procedure for a constant number of times and pick the greatest. Let m be the total number of times to repeat, the probability of success of obtaining the true is more than 1 ( 3 4 )m [12]. We define gcd(x, r) as the greatest common divisor of x and r. And then we could obtain the result gcd(x, r) = r/. If we do not look for a classical algorithm for help to find the coprime ratio, we can also complete the whole algorithm by repeating the quantum procedure. We choose the smaller one of r and x and define it as x, and we

3 choose the smaller one of s/ r and x s/ r and define it as r. We use the new x and r to replace the given x and r in the quantum procedure and repeat the procedure. Every time we repeat the quantum procedure and obtain a result s i / i r i. We need to test if it is the common divisor of r and x. If it is, we claim that the result is the gcd(x, r) and the nonzero result will not change again if we continue the repetition. If not, further repetitions are needed to continue. Totally, the number of repetitions is O(log 2 (n)). Here we need to notice that the method discussed above works successfully only if gcd(s i / i r i,x i+1 ) = gcd(x i, r i ). That means, for example, if r i is lager than x i so that x i+1 = x i, s i needs to share no common factor with x i+1 /r i i = k i. Here we have already considered that gcd(a, b) =gcd(a b, b). But because s i is a random number smaller than i, it maybe bring an extra factor to the result s i / i r i if it shares a common factor with k i. And gcd(s i / i r i, x i+1 ) would be larger than gcd(x i, r i ). Considering this situation our strategy is that when we find the nonzero result do not change again but it is not the factor of either of x and r, we pick the one of x and r which is not divisible by the result as the x i+1 for the next repetition. This would continue until we obtain a result that could be a factor of both x and r. This will not add much to the number of repetitions, since every time we still get a result that is smaller than half of the previous result. So the number of repetitions is still O(log 2 (n)). Complexity. In the quantum procedure we consider the time complexity. The Hadamard gates cost O(1). For the modular addition shown in FIG. 1, the classical calculation of 2 j x for all j cost O(log 2 (n)) t = O((log 2 (n)) 2 ), since we could calculate an addition 2 j x = 2 j 1 x+2 j 1 x for each j and each addition cost O(log 2 (n)), and the quantum circuit totally costs O((log 2 (n)) 2 ) gates containing t U 2i operations each of which costs O(log 2 (n)) for modular addition. So this step costs O((log 2 (n)) 2 + O((log 2 (n)) 2 = O((log 2 (n)) 2. The inverse Fourier transform costs O((log 2 (n)) 2. So the quantum part costs O((log 2 (n)) 2. If we use a classical approach like Stein algorithm to deal with the result of measurement. Finally we need O((log 2 (n)) 2. If we choose to repeat the quantum procedure, the total number of repetitions that are needed is O((log 2 (n)) and the total complexity of the algorithm grows to O((log 2 (n)) 3. Simulation of the algorithm. In this part we give two samples of the computer simulation of our algorithm. In the first one we choose x = 35, r = 40 so of this problem should be 8, shown in FIG. 2. We can see eight uniformly distributed peaks of the probability distribution, each of which has a probability of 1 8. In the second one we choose x = 21, r = 126 so of this problem should be 6, shown in FIG. 3. We can see six uniformly distributed peaks of the probability distribution. As the total number of steps increase, they become more and more concentrated. These two samples show that their behaviors are just the same as Shor algorithm [7, 12]. So FIG. 2. a computer simulation of the quantum procedure in our algorithm, with t = 4, x = 35, r = 40 so that = 8. The possible results of measurement share the same probability of 0.125 and are distributed evenly. The results of measurement are b 2 t. For example, if our detection gives a result of 2. And here we have t = 4 so b 2 4 = 2 and b = 0.125. After calculation we obtain s/ = 0.125. If we use the stein algorithm we could obtain = 8. If we choose to repeat the quantum procedure we could determine that for the next repetition x = s/ r = 5. it presents that our algorithm gives a same structure of results as Shor algorithm. Discussion. The quantum algorithm presented in this Letter is slightly simpler for implementation than the Shor algorithm. In addition, the result also gives a periodic structure just like the complex Shor algorithm. The heart of this algorithm is the application of modular addition, which is known as a basic element of modular exponentiation. So its implementation can act as a prelude before we have sufficient ability to implement the full controlled modular exponentiation. We do not need to design other operations to replace the part of modular addition. And we can analyze the experimental results of this kind of quantum algorithms solving the hidden subgroup problem in an easier way. The implementation of modular multiplier and modular addition considering different circumstances can be seen in many previous works[6, 7, 16, 17]. In the scheme [16], the total number of gates for modular multiplier is 5L + 3, while that for modular addition is 4L + 2, which means we need less qubits than Shor algorithm to get a same result structure as the Shor algorithm. In addition, we have demonstrated that in this algorithm, t = L + 1 + log 2 (2 + 1 2ɛ ), while in Shor algorithm, t = 2L + 1 + log 2 (2 + 1 2ɛ ). It means we need a smaller number of qubits and less gates. It also means that we only need about a half of steps to obtain a result with high enough accuracy. The matrix form of phase gates is as follow, [ ] 1 0 R t = (5) 0 e 2πi/2t Considering Kitaev s approach [5] shown in FIG. 4, the smallest angle that appears in the phase gates is π/2 t 1.

the greatest common divisor problem. Its computational complexity is similar as classical algorithms. We have given the explicit quantum circuit and the processing schemes for the results of the measurements. We also give the computer simulations of the algorithms and analyze the probability distribution of the expected outcomes of the circuit. Finally we discuss the advantages of our algorithm and show that it is a good test algorithm for quantum computers solving the kind of the hidden subgroup problems. Acknowledgements: This work was supported by 4 FIG. 4. The Kitaev s approach to reduce the number of qubits in the quantum circuit. FIG. 3. a computer simulation of our algorithm, with t = 4/5/6/10, x = 12, r = 126 so that = 6. The peaks are distributed evenly but have slightly different probability. The results of measurement are also b 2 t. It means that a larger t leads to a requirement of higher accuracy of the implementation of the phase gates, the same as in the quantum inverse Fourier transform shown in FIG. 5. Thus, this quantum algorithm is a test algorithm for a quantum computer before we have the ability to complete the full implementation of Shor algorithm. In conclusion, we give a quantum algorithm solving FIG. 5. A efficient circuit for quantum Fourier transform. The inverse quantum Fourier transform is just the inverse one of this circuit. the ational Key R & D Plan of China (o. 2016YFA0302104, o. 2016YFA0300600), the ational atural Science Foundation of China (o. 91536108), and the Chinese Academy of Sciences (o. XDB01010000, and o. XDB21030300). [1] P. W. Shor, in proceedings of the 35th Annual Symposium on Foundations of Comupter Science, 124-134 (IEEE computer Society Press, 1994). [2] Rivest R L Shamir A Adleman L. Communications of the ACM 21120 (1978). [3] L. M. K. Vandersypen, M. Steffen, G. Breyta, et al., Experimental realization of Shor s quantum factoring algorithm using nuclear magnetic resonance, ature 414, 883 (2001). [4] T. Monz et al., Realization of a scalable Shor algorithm, Science 351, 1068-1070 (2016). [5] A. Y. Kitaev, eprint arxiv:quant-ph/9511026. [6] S. Beauregard, Circuit for Shor s algorithm using 2n + 3 qubits, Quant. Inf. Comput. 3, 175-185 (2003). [7] S. J. Devitt, A. G. Fowler, L. C. L. Hollenberg. Investigating the practical implementation of Shor s algorithm,

5 Smart Materials, ano-, and Micro-Smart Systems, International Society for Optics and Photonics (2005). [8]. Xu, et al., Quantum factorization of 143 on a dipolarcoupling nuclear magnetic resonance system, Phys. Rev. Lett. 108, 130501 (2012). [9] X. Peng, et al., Quantum adiabatic algorithm for factorization and its experimental implementation, Phys. Rev. Lett. 101, 220405 (2008). [10] C.Y. Lu, et al., Demonstration of a compiled version of Shor s quantum factoring algorithm using photonic qubits, Phys. Rev. Lett. 99, 250504 (2007). [11] M. Mosca and A.Ekert, in Quantum Computing and Quantum Communications, C.P. Williams, Ed., Lecture otes in Computer Science 1509, 174-188 (1999). [12] M. A. ielsen and I. L. Chuang, Quantum Computation and Quantum Information, 216-242, 626-632, (Cambridge University Press, 2000). [13] H. Stark, An Introduction to umber Theory, (MIT Press, 1978). [14] J. Stein, Computational problems associated with Racah algebra, J. Comput. Phys. 1, 397-405 (1967). [15] G. H. Hardy and E. M. Wright. An Introduction to the Theory of umbers, Fourth Edition, 129-151, (Oxford University Press, London, 1960). [16] V. Vedral, A. Barenco, and A. Ekert, Quantum networks for elementary arithmetic operations, Phys. Rev. A 54, 147-153 (1996). [17] R. Van Meter and K. M. Itoh, Fast quantum modular exponentiation, Phys. Rev. A 71, 052320 (2005).