[primTorch] Implements refs for gcd, lcm and remainder (#78747)
This PR implements the references for gcd, lcm and remainder. Additionally, `gcd` is added as a prim, since we currently don't have a while loop construct.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/78747
Approved by: https://github.com/mruberry