标签:img end one amp note log first return ref
Inputs: p, an odd prime. n, an integer which is a quadratic residue (mod p), meaning that the Legendre symbol .
Outputs: R, an integer satisfying .
Once you have solved the congruence with R the second solution is p − R.
Solving the congruence . It is clear that
is odd, and since
, 10 is a quadratic residue (by Euler‘s criterion).
Indeed, observe that and naturally also
. So the algorithm yields two solutions to our congruence.
First write . Now write
and
, observing that
. This latter congruence will be true after every iteration of the algorithm‘s main loop. If at any point,
then
and the algorithm terminates with
.
If , then consider
, a quadratic non-residue of
. Let
. Then
and
, which shows that the order of
is
.
Similarly we have , so the order of
divides
. Suppose the order of
is
. Since
is a square modulo
,
is also a square, and hence
.
Now we set and with this
,
and
. As before,
holds; however with this construction both
and
have order
. This implies that
has order
with
.
If then
, and the algorithm stops, returning
. Else, we restart the loop with analogous definitions of
,
,
and
until we arrive at an
that equals 0. Since the sequence of S is strictly decreasing the algorithm terminates.
标签:img end one amp note log first return ref
原文地址:https://www.cnblogs.com/wuliking/p/11366827.html