Skip to content

Instantly share code, notes, and snippets.

@kittinan
Created March 29, 2015 16:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kittinan/3173c58b32b8e7739b11 to your computer and use it in GitHub Desktop.
Save kittinan/3173c58b32b8e7739b11 to your computer and use it in GitHub Desktop.
Largest palindrome product
<?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