【量子计算-算法】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}},}f(x)=a^{x}{\bmod {N}},
    i.e. the order r{\displaystyle r}r of a{\displaystyle a}a in (ZN)×{\displaystyle (\mathbb {Z} _{N})^{\times }}(\mathbb {Z} _{N})^{\times }, which is the smallest positive integer r for which f(x+r)=f(x){\displaystyle f(x+r)=f(x)}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}}.}{\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 }\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}N=15,a=7,r=4gcd(72±1,15)=gcd(49±1,15){\displaystyle \mathrm {gcd} (7^{2}\pm 1,15)=\mathrm {gcd} (49\pm 1,15)}\mathrm {gcd} (7^{2}\pm 1,15)=\mathrm {gcd} (49\pm 1,15), where gcd(48,15)=3{\displaystyle \mathrm {gcd} (48,15)=3}\mathrm {gcd} (48,15)=3, and gcd(50,15)=5{\displaystyle \mathrm {gcd} (50,15)=5}\mathrm {gcd} (50,15)=5.












 

参考文献:

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

 

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值