English

An O(M(n) log n) algorithm for the Jacobi symbol

Data Structures and Algorithms 2010-11-29 v2 Number Theory

Abstract

The best known algorithm to compute the Jacobi symbol of two n-bit integers runs in time O(M(n) log n), using Sch\"onhage's fast continued fraction algorithm combined with an identity due to Gauss. We give a different O(M(n) log n) algorithm based on the binary recursive gcd algorithm of Stehl\'e and Zimmermann. Our implementation - which to our knowledge is the first to run in time O(M(n) log n) - is faster than GMP's quadratic implementation for inputs larger than about 10000 decimal digits.

Keywords

Cite

@article{arxiv.1004.2091,
  title  = {An O(M(n) log n) algorithm for the Jacobi symbol},
  author = {Richard P. Brent and Paul Zimmermann},
  journal= {arXiv preprint arXiv:1004.2091},
  year   = {2010}
}

Comments

Submitted to ANTS IX (Nancy, July 2010)

R2 v1 2026-06-21T15:09:38.739Z