function smallestCommons(arr) {
const [min, max] = arr.sort((a, b) => a - b);
console.log([min])
const numberDivisors = max - min + 1;
console.log(numberDivisors)
// Largest possible value for SCM
let upperBound = 1;
for (let i = min; i <= max; i++) {
upperBound *= i;
}console.log(upperBound)
// Test all multiples of 'max'
for (let multiple = max; multiple <= upperBound; multiple += max) {
// Check if every value in range divides 'multiple'
let divisorCount = 0;
for (let i = min; i <= max; i++) {
// Count divisors
if (multiple % i === 0) {
divisorCount += 1;
}
}console.log(multiple)
if (divisorCount === numberDivisors) {
return multiple;
}
}
}