
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!

Assigned: Jan. 30th, 2009 Due Date: Feb. 23rd, 2009 Extension Date (with 10% deduction on grading): 5PM, March 2nd, 2009 Spring 2009, CS Department, IIT
x^2 = 1 mod n.
(a) b is a quadratic residue of p if and only if b
p− 1 (^2) = 1 mod p.
(b) b is a quadratic non-residue of p if and only if b
p− 1 (^2) = − 1 mod p.
(a) (5 points) There are only two solutions (i.e., two integers in [1, p − 1])for equation a = x^2 mod p. (b) (5 points) If p = 3 mod 4, then x 1 = a
p+ (^4) mod p, and x 2 = p − x 1 are the only two solutions.
(c) (5 points) If p = 5 mod 8 and a
p− 1 (^4) = 1 mod p, then x 1 = a p+ (^8) mod p, and x 2 = p − x 1 are the only two solutions. (d) (5 points) If p = 5 mod 8 and a
p− 1 (^4) = − 1 mod p, then x 1 = 2a · (4a) p− 5 (^8) mod p, and x 2 = p − x 1 are the only two solutions.
Hint: (1) notice that a
p− 1 (^2) = 1 mod p; (2) notice that 2 is a quadratic non-residue modulo p, if p = 5 mod 8, i.e., there is no integer t such that t^2 = 2 mod p if p = 5 mod 8; (3) an integer b is a quadratic residue modulo p iff b p− 2 1 = 1 mod p.
Here the input integers could be up to 1000 bits. So your code should be able to take care of big integers. Use your code to find what is the last digit of the following number ab^ mod n, when a = 2^123 − 1, b = 2^999 − 1, and n = 2^345 + 1.