Project Euler Problem 5 (PHP)
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?
Script
Execution Time: 19.8054 seconds
$stop = false; for($x=20; $stop == false; $x=$x+20) { for ($y=2; $y<=19; $y++) { if($x%$y == 0) { $stop = true; } else { $stop = false; $y = 21; } } if ($stop == true) { echo $x.PHP_EOL; } }