I'm a professional game developer from Wakefield, England, working for TickTock Games.
I'm a married father of five and I am also the director and lead programmer of Retroburn Ltd.
Martin 'Bytrix' Caine
Father. C++ Games Programmer. Cyclist. Guitarist.
Monday, May 31st 2010 / Web

# Project Euler - problem 5

Problem 5 (yes these are pretty quick ones) from Project Euler is a really easy one again:

2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder.

What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20?

I wrote a simple loop to increment a variable until it found a value that's division by 11,12,13,14,15,16,17,18,19 and 20 all resulted in whole numbers.

There was no need to test numbers between 1 and 10 since the numbers between 11 and 20 are all multiples of those anyway:

``` <?/*******************************************************************  ProjectEuler.net  *  Problem 5  *  2010-05-31  *  Martin Caine *******************************************************************/\$i = 1;while( !(( (\$i/11) == (int)(\$i/11) ) &&         ( (\$i/12) == (int)(\$i/12) ) &&         ( (\$i/13) == (int)(\$i/13) ) &&         ( (\$i/14) == (int)(\$i/14) ) &&         ( (\$i/15) == (int)(\$i/15) ) &&         ( (\$i/16) == (int)(\$i/16) ) &&         ( (\$i/17) == (int)(\$i/17) ) &&         ( (\$i/18) == (int)(\$i/18) ) &&         ( (\$i/19) == (int)(\$i/19) ) &&         ( (\$i/20) == (int)(\$i/20) )) ){  \$i++;  }echo \$i;?> ```     