Pocklington's algorithm is a technique for solving a congruence of the form

where x and a are integers and a is a quadratic residue.
The algorithm is one of the first efficient methods to solve such a congruence. It was described by H.C. Pocklington in 1917.[1]
|
Contents
|
(Note: all
are taken to mean (mod p), unless indicated otherwise.)
Inputs:
Outputs:
. Note that if x is a solution, −x is a solution as well and since p is odd,
. So there is always a second solution when one is found.Pocklington separates 3 different cases for p:
The first case, if p = 4m + 3, with
, the solution is
.
The second case, if p = 8m + 5, with
and
, the solution is
.
, 2 is a (quadratic) non-residue so
. This means that
so
is a solution of
. Hence
or, if y is odd,
.The third case, if p = 8m + 1, put
, so the equation to solve becomes
. Now find by trial and error t1 and u1 so that
is a quadratic non-residue. Furthermore let
.The following equalities now hold:
.Supposing that p is of the form 4m + 1 (which is true if p is of the form 8m + 1), D is a quadratic residue and
. Now the equations

give a solution
.
Let p − 1 = 2r. Then
. This means that either tr or ur is divisible by p. If it is ur, put r = 2s and proceed similarly with
. Not every ui is divisible by p, for u1 is not. The case
with m odd is impossible, because
holds and this would mean that
is congruent to a quadratic non-residue, which is a contradiction. So this loop stops when
for a particular l. This gives
, and because − D is a quadratic residue, l must be even. Put l = 2k. Then
. So the solution of
is got by solving the linear congruence
.
The following are 3 examples, corresponding to the 3 different cases in which Pocklington divided forms of p. All
are taken with the modulus in the example.
Solve the congruence

The modulus is 23. This is
, so m = 5. The solution should be
, which is indeed true:
.
Solve the congruence

The modulus is 13. This is
, so m = 1. Now verifying
. So the solution is
. This is indeed true:
.
Solve the congruence
. For this, write x2 − 13 = 0. First find a t1 and u1 such that
is a quadratic nonresidue. Take for example t1 = 3,u1 = 1. Now find t8, u8 by computing
,
And similarly
such that 
Since t8 = 0, the equation
which leads to solving the equation
. This has solution
. Indeed,
.
|
|||||||||||||||||||||||||||||
This entry is from Wikipedia, the leading user-contributed encyclopedia. It may not have been reviewed by professional editors (see full disclaimer)