next up previous
Next: Rabin-Miller primality testing algorithm Up: Discrete Math, Thirteenth Problem Previous: Discrete Math, Thirteenth Problem

Solovay-Strassen primality testing algorithm

Let $ {\mathbb{Z}}_n^*$ be the set of integers $ 1\leq a\le n$ such that % latex2html id marker 1630
$ {\rm gcd}(a,x)=1$. Recall that the Euler phi function is defined by $ \varphi(n)=\vert{\mathbb{Z}}_n^*\vert$.
\begin{exercise}
% latex2html id marker 832Prove that ${\mathbb{Z}}_n^*$\ is a group under multiplication mod~$n$.
\end{exercise}


\begin{exercise}
% latex2html id marker 835If there is $a\in {\mathbb{Z}}_n^*$...
...t half of the numbers in ${\mathbb{Z}}_n^*$\ satisfy
(\ref{eq1}).
\end{exercise}

Definition 1.1   Let $ p$ be an odd prime. For $ a\in{\mathbb{Z}}$, the Legendre symbol $ {\displaystyle\genfrac{(}{)}{}{}{a}{p}}$ is defined as follows.

\begin{displaymath}
% latex2html id marker 1641{\displaystyle\genfrac{(}{)}{}{...
... x)(x^2\equiv
a\pmod{p})\\
-1 & \mbox{otherwise}.
\end{array}\end{displaymath}

In the second case we say that $ a$ is a quadratic residue mod $ p$; in the third case, $ a$ is a nonresidue mod $ p$. Note that 0 is not a quadratic residue even though $ 0^2=0$.

Theorem 1.2   Let $ p,q$ be odd primes. The Legendre symbol satisfies the following identities.
(1)
If $ a\equiv b\pmod p$ then $ {\displaystyle\genfrac{(}{)}{}{}{a}{p}}={\displaystyle\genfrac{(}{)}{}{}{b}{p}}$.
(2)
$ {\displaystyle\genfrac{(}{)}{}{}{ab}{p}}={\displaystyle\genfrac{(}{)}{}{}{a}{p}}{\displaystyle\genfrac{(}{)}{}{}{b}{p}}$;
(3)
$ {\displaystyle\genfrac{(}{)}{}{}{-1}{p}}=(-1)^{(p-1)/2}$;
(4)
$ {\displaystyle\genfrac{(}{)}{}{}{2}{p}}=(-1)^{(p^2-1)/8}$;
(5)
$ {\displaystyle\genfrac{(}{)}{}{}{p}{q}}={\displaystyle\genfrac{(}{)}{}{}{q}{p}}
(-1)^{\frac{p-1}{2}\cdot\frac{q-1}{2}}$ (this identity, observed by Euler and Legendre and proved by Gauss, is called Quadratic Reciprocity);


\begin{exercise}
% latex2html id marker 918Prove parts (1), (2), and (3) of Theorem \ref{thm:leg}.
\end{exercise}


\begin{exercise}
% latex2html id marker 920For what primes $p$\ is 5 a quadratic residue mod~$p$\ ?
What about 7?
\end{exercise}


\begin{exercise}
% latex2html id marker 922Show that using a factorization ora...
..., that factoring is not expected to
be doable in polynomial time.
\end{exercise}

Definition 1.3   Let $ a$ be an integer and $ b$ be an odd integer. Let $ b=\prod_{i=1}^{\ell} p_i^{k_i}$ be the factorization of $ b$. The Jacobi symbol $ {\displaystyle\genfrac{(}{)}{}{}{a}{b}}$ is defined as follows.

$\displaystyle {\displaystyle\genfrac{(}{)}{}{}{a}{b}}=\prod_{i=1}^{\ell}{\displaystyle\genfrac{(}{)}{}{}{a}{p_i}}^{k_i},
$

where the right hand side of the definition uses the Legendre symbol.


\begin{exercise}
% latex2html id marker 945Show that Theorem \ref{thm:leg} hol...
...ly prime) with the Legendre
symbol replaced by the Jacobi symbol.
\end{exercise}

Recall that Euclid's algorithm computes the greatest common divisor of integers $ a,b$, using

% latex2html id marker 1694
$\displaystyle {\rm gcd}(a,b)= {\rm gcd}(b\ {\rm mod}\ a,a).$ (1)


\begin{exercise}
% latex2html id marker 947Let $0<a\leq b$. Let $a_1=b\ {\rm m...
...number. Consequently,
Euclid's algorithm runs in polynomial time.
\end{exercise}


\begin{exercise}
% latex2html id marker 949Show that we can compute the Jacobi symbol in polynomial
time. {\em Hint.}\ Copy Euclid's algorithm.
\end{exercise}


\begin{exercise}
% latex2html id marker 951Prove:
if $p$\ is an odd prime then...
...he fact that the multiplicative group
${\rm mod}\ p$\ is cyclic).
\end{exercise}

Theorem 1.4   Let $ N$ be an integer. Assume that $ N$ is not a prime and that $ N$ is not $ m^k$ for some $ k\geq 2$. Then there exists $ a\in{\mathbb{Z}}_N^*$ such that

$\displaystyle {\displaystyle\genfrac{(}{)}{}{}{a}{N}}\not\equiv a^{(N-1)/2}\pmod{N}.$ (2)


\begin{exercise}
% latex2html id marker 968Show that if there exists $a\in Z_N...
... at least half of the
numbers in $Z_N^*$\ satisfy (\ref{eq:sol}).
\end{exercise}


\begin{exercise}
% latex2html id marker 970Show that given an integer $N$\ we ...
... Show that $k\le \log_2 N$. Use binary search
for each fixed $k$.
\end{exercise}

Theorem 1.13, and Exercises 1.11, 1.12, 1.14, 1.15 give us a polynomial-time randomized algorithm which on input $ N$,

Amplification. Note that by repeating this algorithm $ k$ times with independent coin flips, the probability that we never find a proof of compositeness when $ N$ is composite is reduced to $ \le 1/2^k$, so if we get ``don't know'' each time, it is a safe bet that $ N$ is prime. (How safe?)


next up previous
Next: Rabin-Miller primality testing algorithm Up: Discrete Math, Thirteenth Problem Previous: Discrete Math, Thirteenth Problem
Varsha Dani 2003-07-25