Optimizing the way of finding lcm
A few minor updates to functions.{gcm,lcm}()