completed lcm calculation