Created
April 29, 2020 21:26
-
-
Save gavinsykes/e7242433355d774e4929f7db15a55bb6 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
require_once '../php_functions.php'; | |
function euler_4($n) { | |
if (($n < 1) || !is_int($n)) { | |
return undefined; | |
} | |
$result = 0 | |
for ($i = 1; $i <= 10**$n; $i++) { | |
for ($j = 1; $j <= 10**$n; $j++) { | |
$prod = $i*$j; | |
if (is_palindrome($prod) && $prod > $result) { | |
$result = $prod; | |
} | |
} | |
} | |
return $result; | |
} | |
$v = $_REQUEST['val']; | |
echo euler_4($v); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment