On the worst case of three algorithms for computing the Jacobi symbol

  • Authors:
  • Jeffrey Shallit

  • Affiliations:
  • Department of Mathematics and Computer Science Dartmouth College Hanover, NE 03755 USA

  • Venue:
  • Journal of Symbolic Computation
  • Year:
  • 1990

Quantified Score

Hi-index 0.00

Visualization

Abstract

We study the worst-case behavior of three iterative algorithms for computing the Jacobi symbol (vu). Each algorithm is similar in format to the Euclidean algorithm for computing gcd(u, v). Eisenstein's algorithm chooses an even quotient at each step. It is shown that the worst case occurs when u = 2n + 1, v = 2n - 1. Lebesgue's algorithm is essentially the least-remainder Euclidean algorithm with powers of 2 removed at each step. Its worst case occurs when u = 2L"n - L"n" "-" "1, v = L"n, where L"0 = 1, L"1 = 1, and L"n = 2L"n" "-" "1 + L"n" "-" "2 for n = 2. The ''ordinary'' Jacobi symbol algorithm is essentially the ordinary Euclidean algorithm with powers of 2 removed at each step. It is the most interesting mathematically of the three. We prove that if the ordinary algorithm on input (u, v) performs n division steps, with uv0 and u + v as small as possible, then u = A"n and v = A"n" "-" "1, where A"0 = 1, A"1 = 3, A"2"n = A"2"n" "-" "1 + 2A"2"n" "-" "2 for n = 1, and A"2"n"+"1 = 2A"2"n + A"2"n" "-" "1 for n = 1. We also discuss the worst-case inputs to the ordinary algorithm under the lexicographic and reverse lexicographic orderings.