Created
April 29, 2020 21:26
-
-
Save gavinsykes/9c4fb0a80b332e164911b9cecfd02895 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 | |
function euler_7($n) { | |
if ($n < 1 || !is_int($n)) { | |
return undefined; | |
} | |
$r = 0; | |
$count = 1; | |
while ($count <= $n) { | |
if (is_prime(2*$r+1)) { | |
$count++; | |
} | |
$r++; | |
} | |
return 2 * $r + 1; | |
} | |
$v = $_REQUEST['val']; | |
echo euler_7($v); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment