Module 8 : Primality Testing

Lecture 1 : Primality Testing

 

Properties: Let p be an odd prime.

        

The properties above can be used to build a recursive algorithm to compute the Jacobi symbol
efficiently. In fact, the algorithm is strongly reminiscent of Euclid’s algorithm for the gcd. Here is how the algorithm applies to compute :

As this method is similar to Euclidean GCD algorithm, its complexity too is O ().

The Jacobi symbol extends the Legendre symbol from primes p to composite odd integers n. One might define the symbol to be +1 if a is a square mod n and -1 if not. However, this would cause the property (3) to fail.
     In order to preserve property (3), we define the Jacobi symbol as follows. Let n be an odd positive integer and let a be a nonzero integer with gcd (a, n) =1. Let

                          n = p1ap2bp3c……prq

be prime factorization of n. Then

The symbols on the right side are Legendre symbols introduced earlier. Note that if n=p, the right side is simply one Legendre symbol, so the Jacobi symbol reduces to the Legendre symbol.