Created
May 14, 2011 05:53
-
-
Save gnp/971959 to your computer and use it in GitHub Desktop.
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
A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 99. | |
Find the largest palindrome made from the product of two 3-digit numbers. | |
---------- | |
$ perl -e 'I: for ($I = 999; $I >= 100; --$I) { for ($J = $I; $J >= 100; --$J) { $p = $I * $J; $q = scalar reverse $p; if ($p eq $q) { printf "%8d = %3d * %3d\n", $p, $I, $J; } } }' | sort -n -r | head -1 | |
906609 = 993 * 913 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment