called the lcm function