Implementing the least common multiple