gcd and inverses