【量子计算-算法】shor大数分解

shor大数分解算法

【量子计算-算法】shor大数分解

【量子计算-算法】shor大数分解

【量子计算-算法】shor大数分解

【量子计算-算法】shor大数分解


Classical part[edit]

  1. Pick a random number a < N.
  2. Compute gcd(aN). This may be done using the Euclidean algorithm.
  3. If gcd(aN) ≠ 1, then this number is a nontrivial factor of N, so we are done.
  4. Otherwise, use the period-finding subroutine (below) to find r, the period of the following function:
    f(x)=axmodN,{\displaystyle f(x)=a^{x}{\bmod {N}},}【量子计算-算法】shor大数分解
    i.e. the order r{\displaystyle r}【量子计算-算法】shor大数分解 of a{\displaystyle a}【量子计算-算法】shor大数分解 in (ZN)×{\displaystyle (\mathbb {Z} _{N})^{\times }}【量子计算-算法】shor大数分解, which is the smallest positive integer r for which f(x+r)=f(x){\displaystyle f(x+r)=f(x)}【量子计算-算法】shor大数分解, or f(x+r)=ax+rmodN≡axmodN.{\displaystyle f(x+r)=a^{x+r}{\bmod {N}}\equiv a^{x}{\bmod {N}}.}【量子计算-算法】shor大数分解
  5. If r is odd, go back to step 1.
  6. If a r /2 ≡{\displaystyle \equiv }【量子计算-算法】shor大数分解 −1 (mod N), go back to step 1.
  7. gcd(ar/2 + 1, N) and gcd(ar/2 - 1, N) are both nontrivial factors of N. We are done.

For example: N=15,a=7,r=4{\displaystyle N=15,a=7,r=4}【量子计算-算法】shor大数分解gcd(72±1,15)=gcd(49±1,15){\displaystyle \mathrm {gcd} (7^{2}\pm 1,15)=\mathrm {gcd} (49\pm 1,15)}【量子计算-算法】shor大数分解, where gcd(48,15)=3{\displaystyle \mathrm {gcd} (48,15)=3}【量子计算-算法】shor大数分解, and gcd(50,15)=5{\displaystyle \mathrm {gcd} (50,15)=5}【量子计算-算法】shor大数分解.


【量子计算-算法】shor大数分解

【量子计算-算法】shor大数分解

【量子计算-算法】shor大数分解

【量子计算-算法】shor大数分解

【量子计算-算法】shor大数分解

【量子计算-算法】shor大数分解

【量子计算-算法】shor大数分解

【量子计算-算法】shor大数分解

【量子计算-算法】shor大数分解


 

参考文献:

[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.