I'm a professional game developer from Wakefield, England.
I'm married with four children and I am the director and lead programmer of Retroburn Game Studios.
Martin 'Bytrix' Caine
All round web guy, games programmer and musician.
emailfacebooktwittermessengersteamxboxliveretroburn
Tags
Archive
Links
Web
XNA
Games
Email Deliverability
Monday, May 31st 2010 / Web

<?
/******************************************************************
*  ProjectEuler.net  *  Problem 8  *  2010-05-31  *  Martin Caine *
******************************************************************/

$string  '73167176531330624919225119674426574742355349194934';
$string .= '96983520312774506326239578318016984801869478851843';
$string .= '85861560789112949495459501737958331952853208805511';
$string .= '12540698747158523863050715693290963295227443043557';
$string .= '66896648950445244523161731856403098711121722383113';
$string .= '62229893423380308135336276614282806444486645238749';
$string .= '30358907296290491560440772390713810515859307960866';
$string .= '70172427121883998797908792274921901699720888093776';
$string .= '65727333001053367881220235421809751254540594752243';
$string .= '52584907711670556013604839586446706324415722155397';
$string .= '53697817977846174064955149290862569321978468622482';
$string .= '83972241375657056057490261407972968652414535100474';
$string .= '82166370484403199890008895243450658541227588666881';
$string .= '16427171479924442928230863465674813919123162824586';
$string .= '17866458359124566529476545682848912883142607690042';
$string .= '24219022671055626321111109370544217506941658960408';
$string .= '07198403850962455444362981230987879927244284909188';
$string .= '84580156166097919133875499200524063689912560717606';
$string .= '05886116467109405077541002256983155200055935729725';
$string .= '71636269561882670428252483600823257530420752963450';

$max 0;

for( 
$i=0$i<996$i++ )
{
  
$sum intvalsubstr$string$i) ) *
         
intvalsubstr$string$i+1) ) *
         
intvalsubstr$string$i+2) ) *
         
intvalsubstr$string$i+3) ) *
         
intvalsubstr$string$i+4) );
  if( 
$sum $max )
  {
    
$max $sum;
  }  
}

echo 
$max;
?>



Read the full article...
Tags:   php   project euler   web
0
Monday, May 31st 2010 / Web

<?
/******************************************************************
*  ProjectEuler.net  *  Problem 7  *  2010-05-31  *  Martin Caine *
******************************************************************/

// create an array to store the primes
$primes = array();
$primes[] = 2;
// count the primes
$i 1;

$n 2;

// break when we get to 10001
while( $i 10001 )
{
  
$n++;
  
$isPrime true;
  foreach( 
$primes as $prime )
  {
    if( (
$n/$prime) == (int)($n/$prime) )
    {
      
$isPrime false;
      break;
    }
  }
  
  if( 
$isPrime )
  {
    
$primes[] = $n;
    
$i++;
  }
}

echo 
$primes[10000];

?>



Read the full article...
Tags:   php   project euler   web
0
Monday, May 31st 2010 / Web
It took less than a minute to complete puzzle number 6 from Project Euler:

Read the full article...
Tags:   php   project euler   web
0
Monday, May 31st 2010 / Web
Problem 5 (yes these are pretty quick ones) from Project Euler is a really easy one again:

Read the full article...
Tags:   php   project euler   web
0
Monday, May 31st 2010 / Web
Another pretty easy one from Project Euler, puzzle 4 simply required building an array of values based on calculations and sorting them to find the highest values:

Read the full article...
Tags:   php   project euler   web
0
Monday, May 31st 2010 / Web
The third problem from Project Euler was a little more complex:

Read the full article...
Tags:   php   project euler   web
0
Monday, May 31st 2010 / Web
The second Project Euler problem was another simple one:

Read the full article...
Tags:   php   project euler   web
0
Monday, May 31st 2010 / Web
Someone I'm following on Twitter posted a link to an interesting site called Project Euler. It's full of interesting maths puzzles which are designed in such a way that you should create a program to calculate the result for you.

Read the full article...
Tags:   php   project euler   web
0