r: gcd/lcm functions