Question
Consider the following problem: - Input: n : positive integer - Output: number of quadratic nonresidues modulo n, where a quadratic nonresidue mod n is
Consider the following problem:
- Input: n: positive integer
- Output: number of quadratic nonresidues modulo n, where a quadratic nonresidue mod n is an integer r in the range of 0 to n - 1 such that there is no integer x in this range where x2 mod n = r.
For example, the quadratic nonresidues of n = 6 are 2 and 5, as shown by the table below:
Thus, the solution for n = 6 is 2.
1. Give pseudocode for an algorithm to compute the number of quadratic nonresidues mod n. Your algorithm should be as efficient as possible. Be sure to describe which data structure(s) you're using and why.
T2 mod 6 z z-, mod b 6-0 14341 1-0 1 2 3 4 5Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started