Project Euler Problem 007

Statement

By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6^(th) prime is 13.

What is the 10001^(st) prime number?

Solution

This solution doesn't need explanation

from CommonFunctions import is_prime
 
if __name__ == '__main__':
    cant = 2
    result = 3
 
    while cant < 10001:
        result += 2
        while not is_prime(result):
            result += 2
        cant += 1
    print("The result is:", result)

The Python file is available for download here.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License