Skip to content

Instantly share code, notes, and snippets.

@shaunlgs
Created December 5, 2015 13:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shaunlgs/79a75244833e35d5ae80 to your computer and use it in GitHub Desktop.
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
<?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