Binary Jacobi Symbol Algorithm: Add, Subtract & Shift

In summary, the conversation discussed the development of a binary Jacobi symbol algorithm and addressed some issues that need to be adjusted in order to make it functional. The algorithm should only use addition, subtraction, and "shift" operations and should also account for special cases when n is equal to 2 or 3.
  • #1
pureouchies4717
99
0
Jacobi Symbol - Binary

NOTE: if its past 8:30 AM Eastern Time, don't worry about it. thanks for the consideration

The Question:
Exercise 13.1. Develop a “binary” Jacobi symbol algorithm, that is, one
that uses only addition, subtractions, and “shift” operations, analogous to
the binary gcd algorithm in Exercise 4.1.



heres the algorithm that i came about with so far:

Note: it is right, except for the fact that there can't be mod, division, multiplication, etc.

can you guys please help me out?




t := 1;
while (a > O and a < O) do

...while (a mod 2 = O) do
...a = a/2;
...if (n mod 8 = 3) or (n mod 8 = 5) then t := -t;

...if (a < n) then
...interchange(a,n);
...if (a mod 4 = 3) and (n mod 4 = 3) then t = -t;

...a := (a-n)12;
...if (n mod 8 = 3) or (n mod 8 = 5) then t = -t;

if (n = I) then return(t) else return(O).
 
Last edited:
Physics news on Phys.org
  • #2


Hi there,

Thank you for sharing your algorithm for the binary Jacobi symbol. It seems like you have a good start, but there are a few things that need to be adjusted in order to make it a fully functional algorithm.

Firstly, the Jacobi symbol is defined for odd numbers, so the while loop should be while (a > 0 and a < n). This will also take care of the issue of division by 0.

Secondly, the algorithm should use only addition, subtraction, and "shift" operations. This means that the mod and division operations need to be replaced with bitwise operations, such as AND, OR, and XOR.

Thirdly, the algorithm should check for the special cases where n is equal to 2 or 3 separately, as they have different rules for calculating the Jacobi symbol.

Lastly, the algorithm should return 1 if the result is 1, -1 if the result is -1, and 0 if the result is 0.

I hope this helps and good luck with your algorithm!
 

Related to Binary Jacobi Symbol Algorithm: Add, Subtract & Shift

1. What is the Binary Jacobi Symbol Algorithm?

The Binary Jacobi Symbol Algorithm is a mathematical algorithm used to calculate the Jacobi symbol for two given integers. This symbol is a mathematical function that is used in number theory to determine if a number is a quadratic residue or not.

2. How does the algorithm work?

The algorithm works by breaking down the given integers into their binary representations and then using a series of add, subtract, and shift operations to calculate the Jacobi symbol. These operations are based on the properties of the Jacobi symbol and are repeated until the final result is obtained.

3. What is the purpose of the Jacobi symbol?

The Jacobi symbol is used to determine if a number is a quadratic residue or not. This means that it can determine if a given integer has a square root that is also an integer. It has various applications in number theory, cryptography, and other fields of mathematics.

4. Can the algorithm be used for large integers?

Yes, the Binary Jacobi Symbol Algorithm can be used for large integers as it is a highly efficient algorithm. However, it is important to note that as the integers get larger, the number of operations required also increases, making it more computationally intensive.

5. How accurate is the algorithm?

The Binary Jacobi Symbol Algorithm is highly accurate and has been extensively tested and used in various mathematical applications. It is based on well-defined mathematical properties and has a high success rate in calculating the Jacobi symbol for any given pair of integers.

Similar threads

  • Calculus and Beyond Homework Help
Replies
15
Views
2K
  • Quantum Physics
Replies
3
Views
966
  • Programming and Computer Science
Replies
9
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
1K
  • Calculus and Beyond Homework Help
Replies
2
Views
2K
  • Programming and Computer Science
Replies
17
Views
1K
  • Programming and Computer Science
Replies
3
Views
1K
  • Programming and Computer Science
Replies
1
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
1K
  • Precalculus Mathematics Homework Help
Replies
2
Views
2K
Back
Top