您的位置:首页 > 其它

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

2018-01-10 19:58 561 查看
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:

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


If r is odd, go back to step 1.
If a r /2 ≡{\displaystyle
\equiv }

 −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: 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}

.



















 

参考文献:

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

 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: