shor大数分解算法




Classical part[edit]
- Pick a random number a < N.
- Compute gcd(a, N). This may be done using the Euclidean algorithm.
- If gcd(a, N) ≠ 1, then this number is a nontrivial factor of N, so we are done.
- Otherwise, use the period-finding subroutine (below) to find r, the period of the following function:
i.e. the order
of
in
, which is the smallest positive integer r for which
, or 
-
- If r is odd, go back to step 1.
- If a r /2
−1 (mod N), go back to step 1. - gcd(ar/2 + 1, N) and gcd(ar/2 – 1, N) are both nontrivial factors of N. We are done.
For example:
,
, where
, and
.









参考文献:
[1] Shor P W. Polynomial-Time Algorithms for Prime Factorization and Discrete Logarithms on a Quantum Computer[M]. Society for Industrial and Applied Mathematics, 1997.
发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/225621.html原文链接:https://javaforall.net
