mirror of
https://github.com/TheAlgorithms/PHP.git
synced 2025-01-17 07:08:13 +01:00
Refactor Project Euler problem 5
This commit is contained in:
parent
14de3b8459
commit
8f6c2feabc
@ -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;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user