"""
Recommended Python Style Guide:
https://peps.python.org/pep-0008/#introduction
"""

import time

# Function to determine if two numbers are coprime (i.e., they share no common divisor other than 1)
def coprime(a, b):
    are_coprime = True  # Assume they are coprime initially
    for i in range(2, min(a, b) + 1):  # Loop through potential divisors starting from 2 up to the smaller number
        if (a % i == 0) and (b % i == 0):  # Check if i divides both a and b
            are_coprime = False  # If a common divisor is found, update the flag
    return are_coprime

# Get user inputs and convert them to integers
a = int(input("Entrez un premier nombre : "))
b = int(input("Puis un deuxieme : "))

# Check for invalid input (both numbers must be positive)
if a <= 0 or b <= 0:
    print("Erreur : vos nombres doivent etre positifs.")
else:
    # Measure the time taken to check if the numbers are coprime
    start_time = time.time()
    are_coprime = coprime(a, b)
    end_time = time.time()

    # Output whether the numbers are coprime or not
    if are_coprime:
        print("Vos nombres sont premiers entre eux.")
    else:
        print("Vos nombres ne sont pas premiers entre eux.")

    # Print the computation time with 5 decimal places
    print(f"Calcule en {end_time - start_time:.5f} secondes.")
