Created
March 29, 2015 16:36
-
-
Save kittinan/3173c58b32b8e7739b11 to your computer and use it in GitHub Desktop.
Largest palindrome product
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Largest palindrome product | |
*/ | |
$max = 0; | |
$output = null; | |
for ($i = 100; $i < 10000; $i++ ) { | |
for ($j = 100; $j < 10000; $j++) { | |
$mul = $i*$j; | |
if ($mul == strrev($mul) && $mul > $max) { | |
$max = $mul; | |
} | |
} | |
} | |
echo "$max\n"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment