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

shor大数分解算法

【量子计算-算法】shor大数分解_第1张图片

【量子计算-算法】shor大数分解_第2张图片


【量子计算-算法】shor大数分解_第3张图片


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}},}
    i.e. the order r{\displaystyle r} of a{\displaystyle a} in (ZN)×{\displaystyle (\mathbb {Z} _{N})^{\times }}, which is the smallest positive integer r for which f(x+r)=f(x){\displaystyle f(x+r)=f(x)}, or f(x+r)=ax+rmodN≡axmodN.{\displaystyle f(x+r)=a^{x+r}{\bmod {N}}\equiv a^{x}{\bmod {N}}.}
  5. If r is odd, go back to step 1.
  6. If a r /2 ≡{\displaystyle \equiv } −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}gcd(72±1,15)=gcd(49±1,15){\displaystyle \mathrm {gcd} (7^{2}\pm 1,15)=\mathrm {gcd} (49\pm 1,15)}, where gcd(48,15)=3{\displaystyle \mathrm {gcd} (48,15)=3}, and gcd(50,15)=5{\displaystyle \mathrm {gcd} (50,15)=5}.


【量子计算-算法】shor大数分解_第4张图片

【量子计算-算法】shor大数分解_第5张图片

【量子计算-算法】shor大数分解_第6张图片

【量子计算-算法】shor大数分解_第7张图片

【量子计算-算法】shor大数分解_第8张图片

【量子计算-算法】shor大数分解_第9张图片

【量子计算-算法】shor大数分解_第10张图片

【量子计算-算法】shor大数分解_第11张图片

【量子计算-算法】shor大数分解_第12张图片


 

参考文献:

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

 

你可能感兴趣的:(量子计算)