Wednesday, February 03, 2010

Project Euler Problem 4

Project Euler Problem 4: Find the largest palindrome made from the product of two 3-digit numbers.

<?php

$p = 0;
for ($i = 999; $i > 99; $i--)
for ($j = $i; $j > 99; $j--)
if (($n = $i*$j) == strrev($n))
$p = max($n, $p);
echo $p;

?>

0 Comments...

Post a Comment

 · Blog Index