// <p>$2520$ is the smallest number that can be divided by each of the numbers from $1$ to $10$ without any remainder.</p>
// <p>What is the smallest positive number that is <strong class="tooltip">evenly divisible<span class="tooltiptext">divisible with no remainder</span></strong> by all of the numbers from $1$ to $20$?</p>
fn gcd(a, b) {
while b != 0 {
var temp = b;
b = a % b;
a = temp;
}
a
}
fn lcm(a, b) {
(a * b) / gcd(a, b)
}
fn solve_euler_005(max_num) {
var result = 1;
for i in range(1, max_num + 1) {
result = lcm(result, i);
}
result
}
// Test with the example (1 to 10)
var test_result = solve_euler_005(10);
assert(test_result == 2520);
// Solve the actual problem (1 to 20)
var result = solve_euler_005(20);
print("The smallest positive number evenly divisible by all numbers from 1 to 20 is: ${result}");
assert(result == 232792560);