One of the oldest surviving fragments of Euclid’s Elements found at Oxyrhynchus, Egypt. It was in this book that Euclid explained his algorithm to find the greatest common divisor of two numbers. This fragment was discovered in 1896 and now resides at the University of Pennsylvania.

Ancient Algorithms: Using the Euclidean Algorithm to Find the Least Common Multiple of a Range of Numbers

Today’s post is going to break down an algorithm in JavaScript that finds the least common multiple of a range of numbers. I’ll be explaining both a basic solution that uses multiple loops and an optimized solution that makes use of both recursion and the Euclidean algorithm.