"""
Recommended Python Style Guide:
https://peps.python.org/pep-0008/#introduction
"""

"""
Fast(er) implementation of is_prime(), where the function does not even look into numbers larger than square root of p
"""
def is_prime(p):
    if p < 2:  # Numbers less than 2 are not prime
        return False

    # Check for divisibility from 2 to the square root of p for efficiency
    # (No need to check divisibility beyond sqrt(p) because if p = a * b,
    # one of the factors, a or b, must be <= sqrt(p))
    for i in range(2, int(p**0.5) + 1):
        if p % i == 0:
            return False  # Return False as soon as a divisor is found
    return True  # Return True if no divisors are found

def find_prime_numbers(n):
    result = []  # List to store prime numbers
    i = 2  # Current number to check for primality

    # Continue until we have found n prime numbers
    while len(result) < n:
        if is_prime(i):  # Check if the current number is prime
            result.append(i)  # Add the prime number to the list
        i += 1  # Move to the next number
    return result

# Prompt the user for a positive integer
n = int(input("Entrez un nombre entier positif : "))

# Validate that the input is a positive integer
if n <= 0:
    print("Erreur : votre nombre doit etre positif.")
else:
    primes = find_prime_numbers(n)  # Find the first n prime numbers
    print(f"Les {n} premiers nombres premiers sont {primes}.")