INMO PS 26 Nov pending - QR/NQR/Legendre symbol
Quadratic Residue(QR) and Non Quadratic Residue(NQR): If x^2 = a mod n then a is quadratic residue mod n. For e.g. 1^2 = 1 mod 3 2^2 = 1 mod 3 3^2 = 0 mod 3 2 is a NQR mod 3 since a square can never leave 2 as residue mod 3. Number of quadratic residues mod a prime: An odd prime 'p' has exactly (p-1)/2 QRs and NQRs excluding 0, ie from 1,2,...p-1. For e.g. 3 as 1 QR and 1 NQR. 7 has 3 each. And so on. Why? If a^2 = b^2 mod p then (a-b)(a+b) = 0 mod p Since p is prime: p | a-b or p | a + b => a = b mod p or a = -b mod p So they will come in pairs. For e.g. 1, p-1 2, p-2 .. and so on. Multiplicate properties of QRs and NQRs QR * QR = QR QR * NQR = NQR NQR * NQR = QR Example: 1*1 = 1 mod 3 1*2 = 2 mod 3 2*2 = 1 mod 3 Legendre symbol: So: (150/7) = (5/7)(5/7)(2/7)(3/7) 0^2 = 0 mod 7 1^2 = 1 mod 7 2^2 = 4 mod 7 3^2 = 2 mod 7 4^2 = 2 mod 7 5^2 = 4 mod 7 6^2 = 1 mod 7 So: (150/7) = -1 * -1 * 1 * -1 = -1 => 150 is NQR Note that we could have simply done 150 = 3 mod 7 So (3/7) ...