Created
November 19, 2013 07:02
-
-
Save pmgupte/7541373 to your computer and use it in GitHub Desktop.
PHP solution to Project Euler problem # 7.
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 | |
| /** | |
| * Problem 7: 10001st prime | |
| * By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13. | |
| * What is the 10001st prime number? | |
| * | |
| * Uses GMP - http://www.php.net/manual/en/book.gmp.php | |
| */ | |
| for($count = 0, $prime=0; $count < 10001; $prime=gmp_intval(gmp_nextprime($prime)), $count++); | |
| echo "10001st prime number is: $prime"; | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment