← Back to challenges

GCD and LCM (Part 2)

PythonHardmathnumbers

Instructions

Create a function that takes two numbers as arguments and return the LCM of the two numbers.

Examples

lcm(3, 5) ➞ 15

lcm(14, 28) ➞ 28

lcm(4, 6) ➞ 12

Notes

  • You may want to use the GCD function to make this a little easier.
  • LCM stands for least common multiple, the smallest multiple of both integers.
python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Are They the Same?