Simple version of lcm, that does not have any dependencies