Refactor Project Euler problem 5

This commit is contained in:
Nima HeydariNasab 2021-10-22 20:15:09 +03:30
parent 14de3b8459
commit 8f6c2feabc

View File

@ -9,10 +9,10 @@
*/
function problem5(): int
{
$number = 21;
$number = 20;
while (true) {
$isSolution = true;
for ($i = 1; $i <= 21; $i++) {
for ($i = 1; $i <= 20; $i++) {
if ($number % $i !== 0) {
$isSolution = false;
break;
@ -21,6 +21,6 @@ function problem5(): int
if ($isSolution) {
return $number;
}
$number++;
$number += 20;
}
}