Created
December 5, 2015 13:59
-
-
Save shaunlgs/79a75244833e35d5ae80 to your computer and use it in GitHub Desktop.
Brute force method to find the smallest number that can be divided with number 1 to 10
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$number = 1; | |
while(true) | |
{ | |
$i = 0; | |
for($i=1; $i < 11; $i++) | |
{ | |
if($number % $i != 0) | |
{ | |
break; | |
} | |
} | |
if($i == 11) | |
{ | |
break; | |
} | |
$number += 1; | |
} | |
echo($number); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment