| Issue |
Wuhan Univ. J. Nat. Sci.
Volume 31, Number 3, June 2026
|
|
|---|---|---|
| Page(s) | 241 - 249 | |
| DOI | https://doi.org/10.1051/wujns/2026313241 | |
| Published online | 24 June 2026 | |
Computer Science
CLC number: TP391
On Computing a for Order (a, n) and Its Application
关于计算 Order (a, n) 的元素a 及其应用
1
School of Business, Xinyang University, Xinyang 464000, Henan, China
(信阳学院 商学院,河南 信阳 464000)
2
School of Computer and Information Technology, Xinyang Normal University, Xinyang 464000, Henan, China
(信阳师范大学 计算机与信息技术学院,河南 信阳 464000)
3
School of Cyber Science and Engineering, Wuhan University, Wuhan 430072, Hubei, China
(武汉大学 国家网络安全学院,湖北 武汉 430072)
† Corresponding author. E-mail: This email address is being protected from spambots. You need JavaScript enabled to view it.
Received:
18
June
2025
Abstract
The order
of an element
in the multiplicative group
, denoted by
, or
for short, plays a significant role in the period of certain pseudo-random number generators and is particularly important in Shor's quantum integer factorization algorithm, as well as in various cryptographic applications. In this paper, we present some numerical results and evidence of suitable
for which
are small and relatively easy to obtain, in the light of quantum integer factorization. The results indicate that the higher the order, the larger of the number of
. Therefore, we propose a quantum algorithm for finding
in
with
, explicitly excluding the trivial solution
, based on Grover's search, but using fewer quantum bits. Moreover, the proposed algorithm achieves a success probability close to 1. As this type of
is commonly used as an RSA modulus, once such an
is found, RSA cryptographic system will be broken.
摘要
元素
在乘法群
中的阶
(记作
, 或简记为
),在某些伪随机数生成器的周期中起着重要作用,并且在 Shor 量子整数分解算法以及诸多密码学应用中尤为关键。本文在量子整数分解的背景下,给出了一些数值结果与证据,表明存在一些合适的
,其
值较小且相对容易获得。结果显示,阶数越高,相应解的数量越多。基于这一观察,本文提出了一种量子算法,用于在满足
的条件下(其中
)寻找非平凡解
,并明确排除了平凡解
,以确保结果对因数分解具有实际意义。该算法基于改进的 Grover 搜索,所需量子比特数更少。此外,所提出的算法在理论上能以接近 1 的概率成功。当
被用作 RSA 模数时,一旦找到这样的
,RSA 密码系统就会被破坏。
Key words: information security / RSA cryptography / quantum computing
关键字 : 信息安全 / RSA密码学 / 量子计算
Cite this article: LI Peng, WANG Yahui, WANG Xinxia, et al. On Computing a for Order (a,n) and Its
Biography: LI Peng, male, Lecturer, research direction: quantum computing and cryptography in finance. E-mail:This email address is being protected from spambots. You need JavaScript enabled to view it.
Foundation item: Supported by the Nanhu Scholars Program for Young Scholars of Xinyang Normal University
© Wuhan University 2026
This is an Open Access article distributed under the terms of the Creative Commons Attribution License (https://creativecommons.org/licenses/by/4.0), which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.
0 Introduction
Quantum computing is an exciting technology at the intersection of computer science and physics, leveraging the unique properties of quantum mechanics to increase the speed of classical computational operations in certain cases. Advances in quantum computing present a serious challenge to the existing public-key cryptosystems, as schemes such as Rivest-Shamir-Adleman (RSA) and ELGamal can be efficiently broken by Shor's algorithm [1-2]. Therefore, studying cryptanalysis in the context of quantum computing has become increasingly important[3].Because the RSA cryptosystem is widely used in industry and government, fast cracking RSA has become an important research direction of modern cryptanalysis. The security of RSA depends on the intractability of the integer factorization problem. Therefore, the core approach to attacking RSA is to design efficient algorithms for factoring its modulus.
One of the most groundbreaking developments in integer factorization occurred in 1994, when Shor discovered a quantum algorithm capable of factoring integers in polynomial time[1-2]. If implemented on a practical quantum computer with several thousand quantum bits, Shor's algorithm can factor integers in probabilistic quantum polynomial time
, representing a significant improvement over the classical number field sieve algorithm[4], whose runtime is sub-exponential runtime of the form
where
. This discovery poses a direct threat to the security of RSA encryption. Although Shor's algorithm operates on a classical computer, its remarkable efficiency stems from a key quantum subroutine. In the following sections, we present a simplified version of this algorithm as shown in Fig. 1, where r is the order of an element a in the multiplicative group
, denoted by
, or
for short.
![]() |
Fig.1 Simplified flowchart of Shor's algorithm |
The emergence of Shor's algorithm has injected new vitality into the research of quantum computing, which has provided a driving force to promote quantum computing research in the last twenty years[5-12]. Current research on quantum factoring mainly focuses on improved or compiled versions of Shor's algorithm, using different techniques that have been proposed and studied. In a word, there are two important research directions in quantum integer factorization. On the one hand, people try to build a (practical) quantum computer, or even other types of physical computers, in order to implement the full version or compiled version of the Shor's algorithm [13-18]. On the other hand, people try to improve, modify and simplify Shor's original algorithm, or even invent new quantum factoring algorithms to be run on quantum computers with fewer quantum bits[19-24]. Ref. [23] proposed a compilied (simplified) and optimized version of Shor's algorithm by computing just the case for
, as this is the simplest possible order for the algorithm to be used to factor
, which only need two qubits.
So far, there are no quantum computers yet that capable of running Shor's algorithm on the large semiprimes n currently used in RSA encryption algorithms. Simulating Grover's algorithm has been achieved. Therefore, from another perspective, we propose an algorithm based on Grover's algorithm, which finds
satisfying
while using fewer qubits.
The organization of the paper is as follows. In Section 1, we demonstrate through computational examples that finding a suitable
such that
holds is computationally as difficult as the Integer Factorization Problem the modulus
, that is,
Computing
such that 
On the other hand, we shall look for some more suitable
for high orders, that is,
. In Section 1, our results show that the higher the order, the greater the number of
. Therefore, from another perspective, instead of directly attempting to find
, we aim to identify a suitable
such that
. We propose a quantum algorithm for finding
in
with
based on Grover's search[25] in Section 2. The conclusion is given in Section 3.
1 Computational Evidence for Suitable Values of a
In this section, we give some numerical computations and pieces of evidences of suitable
for which
are small and relatively easy to obtain, in the light of quantum integer factorization.
Firstly, it is evident that in the computation of
(i.e.,
), the task will be significantly easy for a quantum computer if the period
is short, in particular,
is the shortest possible order one can expect[19].
For
, if the prime factorization of
is known, then
can be found by computing
, where

For example, let
. Then we have





For
(a number with 232 digits and 768 bits), since we know its prime factorization, we get




Thus,

In Table 1, we list the values of a satisfying
, when
is a factorized RSA modulus.
Proposition 1 Computing
such that 
Proof Because we compute
such that
, that is, we obtain
satisfying
.
So we can compute
, that is, we obtain the factors of
.
Since
with
and
two distinct prime numbers, then
can be obtained by computing
, where

Thus, the two non-trivial solutions are
, and the two trivial solutions are
.That is, we obtain
such that
.
Then we shall present some numerical evidences of suitable
such that
with
, since there should be more numbers of
in such cases rather than just two
in
.
We give some computation evidences of different
for certain high order
; note that we shall only consider the case when
with
, since odd orders are not useful in quantum integer factorization.
Let
, then for different possible with
, we get the corresponding
and the number of
(see Table 2).
As can be observed, as the value of
increases, the corresponding number of a also increases, but it dose not grow in a linear manner.
For
, we have the result of Table 3.
This also shows that as the value of
increases, the number of
also increases. Compared with the case
, there are two nontrivial values for
. However, for instance, when
, there are a total of 160 values of
that satisfy the condition
.
In short, the above computing results indicted that the higher the order, the larger the number of
.
The solutions to
for RSA modulus n with known factorization
The corresponding
and the number of
for 
The corresponding
and the number of
for 
2 A Quantum Algorithm for Breaking RSA
2.1 The New Algorithm
Through some numerical computations and pieces of evidences of suitable
for which
is small and relatively easy to obtain, in Section 1, in the light of quantum integer factorization, we find that the higher the order, the larger the number of
. Therefore, from a different perspective, rather than attempting to find the order
of
, we aim to find a suitable value of a such that
. To avoid ambiguity, we explicitly exclude the trivial solution
, since only nontrivial solutions are useful for the factorization of
. Therefore, in this section, we present a quantum algorithm for finding
in
with
based on Grover's search as follows.
Algorithm 1 This algorithm aims to find a solution
in congruence
with
, so that one can compute
in order to factor
.
Step 1 Find a number
, a power of 2 , say
, such that
.
Step 2 Initialize the two quantum registers, Reg1 and Reg2, to the all-zero state:
.
Step 3 Perform a Hadamard transform on Reg1, we get

Step 4 Perform the modular exponentiations
on Reg2, we get

where 
Step 5 Repeat the following steps
times.
Step 5-1 Perform a conditional phase shift
on Reg2, with
receiving a phase shift of
1 , at the same time perform a conditional phase shift
on Reg1, with
receiving a phase shift of
1 , thus


Suppose that the number of solutions of the function
is
, and these solutions are
denoted the operator
, and the definition of function
is as follows,

denoted the operator
.
Step 5-2 Perform the unitary operation
on Reg2, where
, obtaining

Step 5-3 Perform a Hadamard transform on Reg1.
Step 5-4 Perform a conditional phase shift on Reg1, with every computational basis state expect
receiving a phase shift of
1.
Step 5-5 Perform a Hadamard transform on Reg1.
Step 6 Measure Reg1. Suppose the state
has been observed. In fact, the observed
satisfying
with
has a higher probability of being close to 1.
2.2 Algorithm Analysis
The new algorithm has the following properties:
1) The complexity of the algorithm depends on the number of iterations, requiring
operations. It is only a quadratic speed up algorithm compared with
classical algorithm.
2) The success probability of the algorithm also depends on the number of iterations. Ref. [25] has shown that the upper bound on the required number of iterations is

where
is the total number of a search space,
is the number of the solutions of the search problem. That is, in the algorithm,
. Grover iterations must be performed in order to obtain a solution to the congruence equation
, with the success probability closed to 1.
3) Compared with Shor's original algorithm which chooses
satisfying
, this algorithm chooses
satisfying
with
. So the algorithm requires
qubits, and Shor's algorithm for breaking RSA requires
qubits. Obviously
, which indicates that the proposed approach significantly reduces the number of required qubits.
4) Shor's original algorithm tried to fix
and find the smallest
satisfying
which chooses
satisfying
, with the time complexity
. Whereas in the algorithm, we try to find a suitable
, such that
with
. The most significant advantage of the algorithm is that it uses fewer quantum bits, which will be helpful for building a quantum computer with fewer quantum bits, and that in turn is relatively easy to build compared to a quantum computer with more quantum bits.
5) Once the
satisfying
with
is found, one can compute
, provided that
with
and
prime. This can be used to break the famous and widely used RSA cryptographic system.
2.3 Example
We give a complete example, explicitly showing each computational steps of the algorithm.
Example 1 Let
, that is, we can find a solution
satisfying
.
Step 1 Find a number
, a power of 2, say
, such that
.
Step 2 Initialize the two quantum registers, Reg1 and Reg2 with zeroes
.
Step 3 Perform a Hadamard transform on Reg1, we get

Step 4 Perform the modular exponentiations
on Reg2, we get




where 
Step 5 Repeat the following steps 2 times.
Step 5-1 Perform a conditional phase shift
on Reg2, with
receiving a phase shift of
1, and at the same time perform a conditional phase shift
on Reg1, with
receiving a phase shift of
1 , thus




Step 5-2 Perform the unitary operation
on Reg2, where
, obtaining




Step 5-3 Perform a Hadamard transform on Reg1.






Step 5-4 Perform a conditional phase shift on Reg1 with every computational basis state, except
receiving a phase shift of
1 .

Step 5-5 Perform a Hadamard transform on Reg1.




Perform Step 5-1 to Step 5-5 again, we can get

Step 6 Measure Reg1. Suppose that the state
is observed with a higher probability
, that is,
, satisfying
.
By Example 1, since the desired
is obtained, we can efficiently compute
on a classical computer, leading to the prime factorization
.
In order to more clearly present all of the different algorithms, Table 4 provides a detailed comparison of several algorithms in terms of the success probability, time complexity, and the number of required quantum bits. In Table 4,
, and
is the Euler fuction.
Algorithm 1 inherits the same amplitude amplification property as Grover's search, and its success probability can be made arbitrarily close to 1 after a sufficient number of iterations. Therefore, the success probability of Algorithm 1 is denoted by ≈1 in Table 4.
The idea of Shor's algorithm is surprisingly simple: to factor
, one first computes the order
of an element
in the multiplicative group
,
. If the computed
is even, then one further computes, with high probability,
, with
. Consequently, if a practical quantum computer capable of efficiently executing Shor's algorithm can be built, the security of RSA would be fundamentally compromised. However, up to now there are no yet quantum computers that could run Shor's algorithm for the large semiprimes
currently used in RSA encryption algorithms. Since the simulation of Grover's algorithm has been demonstrated, we propose an alternative algorithm inspired by Grover's algorithm, which aims to compute
using fewer qubits. In fact, based on Grover's algorithm, one can find an integer
satisfying
where the algorithm selects
such that 
, with a time complexity of
. That is the algorithm based on Grover's algorithm in Table 4. Whereas in Algorithm 1, we try to find a suitable
such that
with
.The most significant advantage of the algorithm lies in its use of fewer quantum bits. This will facilitate the construction of quantum computers using fewer quantum bits, thereby making practical applications more feasible compared with those systems that require more quantum bits.
Comparison of resource consumption among different algorithms
3 Conclusion
In this paper, through some numerical computations and pieces of evidences of suitable
for which
are small and relatively easy to obtain, in the light of quantum integer factorization, we find that the higher the order, the larger the number of
. Therefore, from another perspective, it inspires us that, instead of trying to find
, we should attempt to find a suitable
such that
. Moreover, we propose a quantum algorithm for finding
in
with
based on Grover's search, but using fewer quantum bits. Moreover, the success probability is close to 1. As this type of
is commonly used as an RSA modulus, once such an
is found, the famous and widely used RSA cryptographic system will be broken completely. As a future direction, one could investigate a quantum algorithm for attacking RSA by exploiting lattice-based shortest vector problems, in conjunction with properties of the Euler totient function and techniques that reduce integer factorization to related computational problems.
References
- Shor P W. Algorithms for quantum computation: Discrete logarithms and factoring [C]//Proceedings of 35th Annual Symposium on Foundations of Computer Science. New York:IEEE Computer Society Press, 1994:124-134. [Google Scholar]
- Shor P W. Polynomial-time algorithms for prime factorization and discrete logarithms on a quantum computer[J]. SIAM Journal on Computing, 1997, 26(5): 1484-1509. [Google Scholar]
- Zhang H G, Han W Y, Lai X J, et al. Survey on cyberspace security[J]. Science China Information Sciences, 2024, 58: 1-43. [Google Scholar]
- Lenstra A K, Lenstra H W. The development of the number field sieve[C]//Lecture Notes in Mathematics 1554. Berlin:Springer-Verlag, 1993. [Google Scholar]
- Battarbee C, Kahrobaei D, Perret L, et al. A subexponential quantum algorithm for the semidirect discrete logarithm problem[C]//Post-Quantum Cryptography. Cham: Springer-Vrverlag, 2024: 202-226. [Google Scholar]
- Wu W Q, Zhang H G, Mao S W, et al. A public key cryptosystem based on data complexity under quantum environment[J]. Science China Information Sciences, 2015, 58(11): 1-11. [NASA ADS] [Google Scholar]
- Zhang H G, Mao S W, Wu W Q, et al. Overview of quantum computation complexity theory[J]. Chinese Journal of Computers, 2016, 39(12): 2403-2428(Ch). [Google Scholar]
- Regev O. An efficient quantum factoring algorithm[J]. Journal of the ACM, 2025, 72(1): 1-13. [Google Scholar]
- Biswas S, Das P. Analysis of quantum cryptology and the RSA algorithms defense against attacks using Shor's algorithm in a post quantum environment[M]//Computational Intelligence in Communications and Business Analytics. Cham: Springer-Verlag, 2023: 72-87. [Google Scholar]
- Wu W Q, Wu J H, Guo L N. Multi-party quantum private comparison based on bell states[J]. Entropy, 2023, 25(8): 1156. [Google Scholar]
- Imran M, Ivanyos G. Efficient quantum algorithms for some instances of the semidirect discrete logarithm problem[J]. Designs, Codes and Cryptography, 2024, 92(10): 2825-2843. [Google Scholar]
- Ha J, Lee J, Heo J. Resource analysis of quantum computing with noisy qubits for Shor's factoring algorithms[J]. Quantum Information Processing, 2022, 21(2): 60. [Google Scholar]
- Wang C, Wang Q D, Hong C L, et al. Quantum annealing public key cryptographic attack algorithm based on D-wave advantage[J]. Chinese Journal of Computers, 2024, 47(5): 1030-1044(Ch). [Google Scholar]
- Wang B N, Yao H N, Hu F, et al. Quantum annealing distributed integer decomposition study of local field coefficient h and coupling coefficient J with stability Ising model[J]. Scientia Sinica: Physica, Mechanica & Astronomica, 2020, 50(3):030301(Ch). [Google Scholar]
- Xu N Y, Zhu J, Lu D W, et al. Quantum factorization of 143 on a dipolar-coupling nuclear magnetic resonance system[J]. Physical Review Letters, 2012, 108(13): 130501. [Google Scholar]
- Lucero E, Barends R, Chen Y, et al. Computing prime factors with a Josephson phase qubit quantum processor[J]. Nature Physics, 2012, 8(10): 719-723. [Google Scholar]
- Monz T, Nigg D, Martinez E A, et al. Realization of a scalable Shor algorithm[J]. Science, 2016, 351(6277): 1068-1070. [Google Scholar]
- Kumar M, Mondal B. Study on implementation of Shor's factorization algorithm on quantum computer[J]. SN Computer Science, 2024, 5(4): 413. [Google Scholar]
- Cao Z J, Cao Z F, On Shor's factoring algorithm with more registers and the problem to certify quantum computers[EB/OL]. [2014-09-10]. https://arxiv.org/abs/1409.7352. [Google Scholar]
- Ekerå M, Håstad J. Quantum algorithms for computing short discrete logarithms and factoring RSA integers[C]//Post-Quantum Cryptography. Cham: Springer International Publishing, 2017: 347-363. [Google Scholar]
- Tesoro M, Siloi, Jaschke D, et al. Quantum inspired factorization up to 100-bit RSA number in polynomial time[EB/OL]. [2024-12-12]. https://arxiv.org/abs/2410.16355. [Google Scholar]
- Wang Y H, Zhang H G. Quantum algorithm for attacking RSA based on Fourier transform and fixed-point[J]. Wuhan University Journal of Natural Sciences, 2021, 26(6): 489-494. [Google Scholar]
- Smolin J A, Smith G, Vargo A. Oversimplifying quantum factoring[J]. Nature, 2013, 499(7457): 163-165. [CrossRef] [PubMed] [Google Scholar]
- Xiao L, Luo L, Mateus P. Distributed Shor's algorithm[J]. Quantum Information and Computation, 2022, 23(1&2):27-44. [Google Scholar]
- Nielsen M A, Chuang I L. Quantum Computation and Quantum Information[M]. Cambridge: Cambridge University Press, 2000. [Google Scholar]
-
Liu L H, Cao Z J. On computing
and its application[J]. Information and Computation, 2006, 204(7): 1173-1178.
[Google Scholar]
All Tables
All Figures
![]() |
Fig.1 Simplified flowchart of Shor's algorithm |
| In the text | |
Current usage metrics show cumulative count of Article Views (full-text article views including HTML views, PDF and ePub downloads, according to the available data) and Abstracts Views on Vision4Press platform.
Data correspond to usage on the plateform after 2015. The current usage metrics is available 48-96 hours after online publication and is updated daily on week days.
Initial download of the metrics may take a while.

