Wednesday, February 03, 2010

Project Euler Problem 5

Project Euler Problem 5: What is the smallest number divisible by each of the numbers 1 to 20?

<?php

for ($n = 20; ; $n += 20)
{
for($i = 20; $i > 10; $i--)
if ($n%$i) continue 2;
break;
}
echo $n;

?>

0 Comments...

Post a Comment

 · Blog Index