Sieve algorithms for perfect power testing Article Received: 13 February 1990 Revised: 10 January 1991 DOI:
Cite this article as: Bach, E. & Sorenson, J. Algorithmica (1993) 9: 313. doi:10.1007/BF01228507 Abstract
A positive integer
n is a perfect power if there exist integers x and k, both at least 2, such that n=x . The usual algorithm to recognize perfect powers computes approximate k kth roots for k≤log 2 n, and runs in time O(log 3 n log log log n).
First we improve this worst-case running time to
O(log 3 n) by using a modified Newton's method to compute approximate kth roots. Parallelizing this gives an NC 2 algorithm.
Second, we present a sieve algorithm that avoids
kth-root computations by seeing if the input n is a perfect kth power modulo small primes. If n is chosen uniformly from a large enough interval, the average running time is O(log 2 n).
Third, we incorporate trial division to give a sieve algorithm with an average running time of
O(log 2 n/log 2 log n) and a median running time of O(log n).
The two sieve algorithms use a precomputed table of small primes. We give a heuristic argument and computational evidence that the largest prime needed in this table is (logn)
1+; assuming the Extended Riemann Hypothesis, primes up to (log O(1) n) 2+ suffice. The table can be computed in time roughly proportional to the largest prime it contains. O(1)
We also present computational results indicating that our sieve algorithms perform extremely well in practice.
Key words Perfect powers Number theoretic algorithms Riemann hypothesis Newton's method Sieve algorithms Parallel algorithms Average-case analysis
This work forms part of the second author's Ph.D. thesis at the University of Wisconsin-Madison, 1991. This research was sponsored by NSF Grants CCR-8552596 and CCR-8504485.
Communicated by Allan Borodin.
E. Bach. How to generate factored random numbers.
SIAM J. Comput.
E. Bach, G. Miller and J. Shallit. Sums of Divisors, perfect numbers, and factoring.
SIAM J. Comput.
E. Bach and J. Shallit. Factoring with cyclotomic polynomials.
P. W. Beame, S. A. Cook and H. J. Hoover. Log depth circuits for division and related problems.
SIAM J. Comput.
R. P. Brent. Multiple precision zero-finding methods and the complexity of elementary function evaluation. In J. F. Traub, editor,
Analytical Computational Complexity
, pp. 151–176. Academic Press, New York, 1976.
A. Cobham. The recognition problem for the set of perfect squares. In
Proceedings of the 7th Annual Symposium on Switching and Automata Theory, pp. 78–87, 1966.
G. E. Collins. Computing multiplicative inverses in
Multiplicative Number Theory
. Springer-Verlag, New York, 1980.
J. Dixon. Asymptotically fast factorization of integers.
S. Goldwasser and J. Kilian. Almost all primes can be quickly certified. In
Proceedings of the 18th Annual ACM Symposium on Theory of Computing, pp. 316–329, 1986.
S. W. Golomb. A new arithmetic function of combinatorial significance.
J. Number Theory
J. L. Hafner and K. S. McCurley. On the distribution of running times of certain integer factoring algorithms.
G. H. Hardy and E. M. Wright.
An Introduction to the Theory of Numbers
, Oxford University Press, Oxford, 5th edition. 1979.
K. Ireland and M. Rosen.
A Classical Introduction to Modern Number Theory
. Springer-Verlag, New York, 1982.
W. B. Jurkat and H.-E. Richert. An improvement of Selberg's sieve method I.
R. Karp and V. Ramachandran. Parallel algorithms for shared memory machines. In J. van Leeuwen, editor,
Algorithms and Complexity
, Chapter 17, pp. 871–941. Handbook of Theoretical Computer Science Series, Volume A. Elsevier, Amsterdam, and MIT Press, Cambridge, MA, 1990.
D. E. Knuth.
The Art of Computer Programming: Seminumerical Algorithms
, Volume 2, 2nd edition. Addison-Wesley, Reading, MA. 1981.
D. E. Knuth and L. Trabb Pardo. Analysis of a simple factorization algorithm.
Theoret. Comput. Sci.
A. K. Lenstra, H. W. Lenstra, Jr., M. S. Manasse and J. M. Pollard. The number field sieve. In
Proceedings of the 22nd Annual ACM Symposium on Theory of Computing, pp. 564–572, 1990.
H. W. Lenstra, Jr. Factoring integers with elliptic curves.
Ann. of Math.
V. Miller. Private communication, 1989.
C. A. Neff. Specified precision polynomial root isolation is in NC. In
Proceedings of 31st Annual IEEE Symposium on Foundations of Computer Science, pp. 152–162, 1990.
V. Pan. Fast and efficient algorithms for sequential and parallel evaluation of polynomial zeros and of matrix polynomials. In
Proceedings of the 26th Annual IEEE Symposium on Foundations of Computer Science, pp. 522–531, 1985.
J. M. Pollard. Theorems on factorization and primality testing.
Math. Proc. Cambridge Philos. Soc.
C. Pomerance. Fast, rigorous factorization and discrete logarithm algorithms. In D. S. Johnson, A. Nishizeke, A. Nozaki, and H. S. Wilf, editors,
Discrete Algorithms and Complexity: Proceedings of the Japan-US Joint Seminar
, pp. 119–143. Perspectives in Computing Series, Volume 15, Academic Press, Boston. 1987.
P. Pritchard. Fast compact prime number sieves (among others).
J. B. Rosser and L. Schoenfeld. Approximate formulas for some functions of prime numbers.
Illinois J. Math.
J. Shallit. Course Notes for Number Theory and Algorithms. Dartmouth College, 1989.
V. Shoup. On the deterministic complexity of factoring polynomials over finite fields.
Inform. Process. Lett.
E. C. Titchmarsh. A divisor problem.
Rend. Circ. Mat. Palermo
S. S. Wagstaff, Jr., Greatest of the least primes in arithmetic progressions having a certain modulus.
Google Scholar Copyright information
© Springer-Verlag New York Inc. 1993