Prime factorization algorithm based on parameter optimization of Ising model

This paper provides a new (second) way, which is completely different from Shor’s algorithm, to show the optimistic potential of a D-Wave quantum computer for deciphering RSA and successfully factoring all integers within 10000. Our method significantly reduced the local field coefficient \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$h$$\end{document}h and coupling term coefficient \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$J$$\end{document}J by more than 33% and 26%, respectively, of those of Ising model, which can further improve the stability of qubit chains and improve the upper bound of integer factorization. In addition, our results obtained the best index (20-bit integer (1028171)) of quantum computing for deciphering RSA via the quantum computing software environment provided by D-Wave. Furthermore, Shor’s algorithm requires approximately 40 qubits to factor the integer 1028171, which is far beyond the capacity of universal quantum computers. Thus, post quantum cryptography should further consider the potential of the D-Wave quantum computer for deciphering the RSA cryptosystem in future.

Quantum annealing. Quantum annealing, as the core algorithm of a D-Wave quantum computer, has the potential to approach or even achieve the global optima in an exponential solution space, corresponding to the quantum evolution towards the ground state of the Hamiltonian problem 24 . The quantum processing units (QPUs), which are the core components for performing quantum annealing, are designed to solve quadratic unconstrained binary optimization (QUBO) problems 25,26 , where each qubit represents a variable, and the couplers between qubits represent the costs associated with qubit pairs.
The objective form of the QUBO that the QPU is designed to minimize is as follows: T where Obj represents objective function of QUBO, x is a vector of binary variables of size N , and Q is an × N N real-valued matrix characterizing the relationship between the variables. Thus, any problem given in such a form can be solved by the D-Wave quantum annealer.
Multiplication table for factorization. Quantum annealing uses the quantum effects generated by quantum fluctuations to realize the global optimal solution of the objective function. The integer factorization problem can be transformed into a combination optimization problem that can be handled by the quantum annealing algorithm, and the minimum energy value can be output through the quantum annealing algorithm. At this time, the minimum value is the successful solution of integer factorization. To clarify the integer factorization method via quantum annealing, we introduce a multiplication table to illustrate the feasibility of mapping the integer factorization problem to Ising model (a model can be processed by a D-Wave quantum computer). We illustrate the factorization of the integer multiplication table by factoring = × N p q, where p and q are prime numbers. Table 1 shows the factorization of = × 143 11 13. In Table 1, p i and q i represent the bits of the multipliers, and z ij is the carried bits from ith bit to the jth bit. All the variables p i , q i , and z ij in the equations are binary.
Note: All of the variables involved in Table 1 can only take the values of {0, 1} . Adding each column leads to the following equations: 2 , and p q p q ( 1 ) The objective function is defined as the sum of squares of the three equations. It can be given as follows: It can be seen from the above that the minimum value of Eq. (12) is 0, that is, p p q ( , , 1 , and q ) 2 are the values that minimize Eq. (12), and it is also the solution of Eqs. (9)- (11). This means that the values of p p q ( , , 1 , and q ) 2 represent the solution to the factorization problem. Equations (13)- (15) are further simplified to the following We define the objective function as the sum of the squares of all the columns as follows: Since Ising model can only deal with the interaction of two variables, it is necessary to process polynomials greater than the 2-local term. According to the properties = p p 2 , = q q 2 , and = c c 2 (the values of p, q and c are 0 or 1), Eq. (19) is expanded and simplified, and the polynomials of more than 2-local term are replaced by the following equation 30 (for more information about factorization refer to ref. 30 ): We replace p q 1 1 , p q 1 2 , p q 2 2 , and p q 2 1 with t 1 , t 2 , t 3 , and t 4 , respectively. In Eq. (20), the variable x i is used to represent the rule that the cubic term is reduced to the 2-local term. For example, the expansion term p q q 1 1 2 in Eq. (19) is replaced by 1 . Then, we perform variable replacement to transform the variables into the domain 0, 1 by using 11 3 , and = x t 12 4 . Finally, via the correspondence = p s finally simplifies to the following:  www.nature.com/scientificreports www.nature.com/scientificreports/ The local field h represents the coefficient value of the single term of all s i variables, and the coupling J is the coefficient value of the 2-local term for all s s i j variables. The final model can be given as follows: 130 5 107 5 130 5 107 5 41 82 3 6 137 81 107 81  Then, the model given in Eqs. (22)-(23) can be directly solved by the D-Wave machine or the qbsolv software environment can be used to perform the quantum annealing algorithm. In this way, the model for the factorization can be generalized to any integer. Furthermore, it is a scalable model for any large integer in theory and it is a real potential application for D-Wave.
In the case when the factorization increases in Shuxian Jiang et al. 30 , the growing number of qubits and the huge coupler strength in the theoretical quantum model will result in a nontrivial impact on the QA precision in the real D-Wave machine. Especially for limit-connectivity hardware, too high of costs regarding the number of qubits greatly limits the generalization and scalability of the factorization in large cases. In addition, the reduction from the 3-local term to the 2-local term increases the coupler strength and local field coefficient, especially for large integers.
This paper proposes a new model that addresses two perspectives: saving qubit resources and simplifying the quantum model to factor larger integers with fewer qubits. Using this way, we can reduce the number of involved qubits and the range of the coupler strength between qubits without any loss of generalization. It is expected to solve larger integers with fewer qubits so that the D-Wave can provide a more powerful capacity to factor large integers in the future.
Optimization of model parameters. In Ising model in ref. 30 , they did not consider the restrictions on the final model derived from the target values, which may cause too many carries to be involved in the model. Here we introduce the constraints derived from the difference between the target values and the maximal output of each column. The carries involved can be directly removed in some cases.
As shown in the improved multiplication table of Table 2  Actually, the method of ref. 32 is designed to reduce the number of qubits, and thus the improvements to the complexity of the model are limited. The main reason is that there is a "2" in Eq. (20), which leads to many high coupler strengths and local field coefficients in the final Hamiltonian resulting in fragile quantum states. Therefore, another optimization should be proposed to solve the above problem without the loss of generalization and scalability.
As mentioned above, we mainly focus on the optimization of the model parameters. Jiang et al. 30 a way to reduce the 3-local term to a 2-local term, which increased the local field coefficient and coupler strength parameters, especially for large integers. In the integer factorization problem based on quantum annealing, the reduction of the model parameters is beneficial to reducing the hardware requirements and the precision of quantum annealing. To reduce the 3-local term to a 2-local term in the integer factorization process, inspired by ref. 35   The negative term is the same as ref. 30 . We mainly prove our optimization of the positive term, that is, why the positive term  Table 3 is a combination of 16 values of x 1 , x 2 , x 3 , and x 4 . The values of x 1 , x 2 , x 3 , and x 4 are 0 or 1. The output of is given in the last column, followed by √ or × to represent whether x x x 1 2 3 equals 4 + x 4 ) or not. As mentioned earlier, the integer factorization problem is the problem of finding the minimum value of a function. In other words, solving the minimum value of x x x 1 2 3 is the same as solving . Take the first two rows of the Table 3 as an example for the following illustration.
In this case, where = . Therefore, At this time, x x x 1 2 3 is equivalent to 4 . The dimension reduction method in this paper is not only applicable to the integer 143, but it is also applicable to the case where the polynomial of the objective function of any integer is greater than the quadratic term, such as the factorization of the 20-bit integer 1028171. A detailed analysis of the factorization is shown in the supplemental material. The method is universal and extensible. We do the following analysis. Assume that the objective function of the integer factorization is as follows: where g x ( ) and f x x x ( , , ) i j k are polynomials composed of two-local terms and 3-local terms, respectively. Then, it can be transformed based on Eq. (27) as follows: x n k i j i n j n n min x n n Therefore, the minimum value that solves the objective function S x ( ) min is equivalent to the minimum value of solving the 3-local term f x ( ), namely, the value of . Similarly, we analyze the 4-local term in the function.  www.nature.com/scientificreports www.nature.com/scientificreports/ f x x x x ( , , , ) i j k l is a polynomial composed of 4-local terms. We consider x k and x l as a whole, and obtain Eq.
i j k l x n k l i j i n j n n n = + − − + .
For the 3-local term x x x n k l in Eq. (30), the dimensionality reduction formula x n k i j i n j n n n is used again to obtain the following: n k l x m l n k n m k m m m Finally, the final 4-local term is reduced to a 2-local term as follows:  Table S1 of the supplemental material shows the factorization of integer 1028171. The qbsolv software environment is a decomposition solver that finds the minimum value given by a QUBO problem by splitting it into pieces that are solved either via a D-Wave system or a classical tabu solver. For more information about the tool, please refer to http://github.com/dwavesystems/qbsolv. The simulations are based on the combination of the two optimizations, which can be divided into the following steps.
• Step 1. Give the improved multiplication table of Jiang et al. 30 that is divided into several columns. It's complexity is less than O log N ( ( )) 2 .
• Step 2. Give the original model based on the optimization in ref. 32 . The complexity of this step is less than O log N (( ( )) ) In the above simulations, Steps 1-4 are classical calculations, and the complexity is less than O log N (( ( )) ) 2 3 .
Step 5 performs a quantum annealing calculation. The complexity increases as the integer to be factored becomes larger, and the overall complexity is less than O log N (( ( )) ) 2 2 . This algorithm realizes the hybrid computing structure of quantum and classical, and exerts the optimal computing power of the distributed processing problem of both quantum and classical.
Take the factorization on 143 as an example, the final input is given as follows: 25 12 24 ] (33)

Results
Due to the accuracy of the error correcting and quantum manipulation technique, the short-time decoherence, the susceptibility to various noises, etc., the progress of universal quantum devices is slow, which limits the development and practical applications of Shor's algorithm. The maximum factorization ability of Shor's algorithm is currently the integer 85. However, D-Wave quantum computers have rapidly developed, and the number of qubits has been doubling every other year. Based on the quantum annealing method, we factor the integer 1028171. Although our method requires more qubits than Shor's algorithm to factor the same integer, Shor's algorithm is highly dependent on high-precision hardware. Actually, Science, Nature, and the National Academies of Sciences (NAS) are consistent in that it will be years before code-cracking by a universal quantum computer is achieved.
The existing works based on NMR utilize the special properties of certain primes to perform principle-of-proof experiments. The maximum integer of factorization based on an NMR platform is 291311. The integer factorization method based on the NMR platform is not applicable to all integers and is not universal and scalable.
Actually, our method is general and can factor up to 20-bit (1028171) integers, making it superior to the results obtained by any other physical implementations, including general-purpose quantum platforms (the Hua-Wei quantum computing platform), and far beyond the theoretical value (factor up to 10-bit integers) that can be obtained by the latest IBM Q System One TM if it can run Shor's algorithm. Table 4 shows the parameter values of Jiang et al. 's method 30 for integer factorization (please note that all the data of ref. 30 are given via our simulations, just for reference). Table 5 shows the factorization results of our method for the integers 143, 59989, 376289, 1005973 and 1028171. It can be seen from Table 5 that our method can successfully factor the integers 1005973 and 1028171. Jiang et al. 's method can factor up to the integer 376289, whereas ours method can achieve the factorization of the integer 1028171, making it superior to the results obtained by any other physical implementations. The reduction of the qubits can reduce the hardware requirements of the quantum annealing machine and further boost the accuracy of quantum annealing, which has great practical significance. In the case of the hardware restrictions of the quantum machine, our goal is to achieve the factorization of a larger-scale integer 1028171 with fewer qubits, which is the best integer factorization result solved by the quantum algorithm. Tables 4 and 5 show that the optimization model can further reduce the weight of the qubits and the range of the coupler strength involved in the problem model, which can advance the large-scale integers in the D-Wave machine. Table 6 shows a comparison of the different algorithms when factoring the integer 7778 = × 31 251. Note: The values of the local field coefficient h and coupler strength J are the absolute values of the parameter ranges. Table 6 takes the maximum integer 7718 that was factored by Warren, R.H. 34 as an example and compares the coefficients of Ising model and qubits. In the actual quantum annealing experiment, the excessive coupling strength between the qubits reduces the possibility of reaching the ground state, and finally reduces the success rate of the integer factorization. It can be seen from Table 6 that the proposed method achieves the lowest local field coefficient h and coupling coefficient J, reduces the ranges of the coefficients of Ising model, and uses far fewer qubits than Warren, R.H. 34 . The reduction of the parameter value ranges can reduce the demand for qubit coupling strength, make the physical qubit flip unified, effectively increase the possibility of quantum annealing reaching the global optimal, and improve the success rate of integer factorization. In the case of insufficient precision and the immature development of existing quantum devices, the proposed method can effectively reduce the hardware requirements and improve the success rate of deciphering RSA via quantum annealing. In addition, our method successfully factors all integers within 10000, whereas Warren, R.H. 34 traversed and factored all integers within 1000.