Suppose there is a probabilistic algorithm \(A\) that takes as input an integer
\(n\) of the form \(n=p q,\) where \(p\) and \(q\) are distinct, \(\ell\) -bit primes,
with \(p=2 p^{\prime}+1\) and \(q=2 q^{\prime}+1,\) where \(p^{\prime}\) and
\(q^{\prime}\) are prime. The algorithm also takes as input \(\alpha, \beta
\in\left(\mathbb{Z}_{n}^{*}\right)^{2} .\) It outputs either "failure," or
integers \(x, y,\) not both zero, such that \(\alpha^{x} \beta^{y}=1\).
Furthermore, assume that \(A\) runs in expected polynomial time, and that for
all \(n\) of the above form, and for randomly chosen \(\alpha, \beta
\in\left(\mathbb{Z}_{n}^{*}\right)^{2}\), \(A\) succeeds in finding \(x, y\) as
above with probability \(\varepsilon(n) .\) Here, the probability is taken over
the random choice of \(\alpha\) and \(\beta,\) as well as the random choices made
during the execution of \(A\) on input \((n, \alpha, \beta)\). Show how to use \(A\)
to construct another probabilistic algorithm \(A^{\prime}\) that takes as input
\(n\) as above, runs in expected polynomial time, and that satisfies the
following property:
if \(\varepsilon(n) \geq 0.001,\) then \(A^{\prime}\) factors \(n\) with probability
at least \(0.999 .\)