Fix _refs.lcm using floating point maths (#82950)
`lcm` is meant to use integer maths, but the use of `true_divide`
introduces a promotion to float and thus a loss of precision.
This also introduces promoting low precision integers to int32 which
is required for 100% consistency with the C++ implementation since the
"usual arithmetic conversions" means the intermediate terms are
calculated to `int` precision in C++. This only really matters when the
lower precision dtype would overflow, however the test cases for lcm
do involve overflows.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/82950
Approved by: https://github.com/ngimel