pub fn legendre_symbol(a: &BigInt, q: &BigInt) -> i32