29 lines
582 B
Plaintext
29 lines
582 B
Plaintext
// 2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder.
|
|
// What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20?
|
|
//
|
|
// Correct Answer: 232_792_560
|
|
|
|
num <- 20;
|
|
should_continue <- 1;
|
|
i <- 2;
|
|
|
|
loop should_continue {
|
|
should_continue = 0;
|
|
|
|
i = 20;
|
|
loop i >= 2; i = i - 1 {
|
|
if num % i != 0 {
|
|
should_continue = 1;
|
|
|
|
// break
|
|
i = 0;
|
|
}
|
|
}
|
|
|
|
if should_continue == 1 {
|
|
num = num + 20;
|
|
}
|
|
}
|
|
|
|
print num;
|