top of page


Finding the 10,001st Prime Number - Project Euler Problem 7
Problem 7 asks: What is the 10,001st prime number? My approach uses a straightforward primality test with trial division up to the square root of each candidate number. Here's the complete Python solution: python import math def is_prime (n): if n < 2 : return False for i in range ( 2 , int (math.sqrt(n)) + 1 ): if n % i == 0 : return False return True prime_list = [] for i in range ( 0 , 999999 ):
4 days ago1 min read
bottom of page