import math
x = int(input())
y = int(input())
z = int(input())
if x >= 1 and y >= 1 and z >= 1:
if math.gcd(x, y) == 1 and math.gcd(y, z) == 1 and math.gcd(x, z) == 1:
print("взаимно простые")
else:
print("не взаимно простые")
вот :) def calculate_hcf(x, y):
if x > y:
smaller = y
else:
smaller = x
for i in range(1, smaller + 1):
if ((x % i == 0) and (y % i == 0)):
hcf = i
return hcf
x = int(input())
y = int(input())
z = int(input())
if x >= 1 and y >= 1 and z >= 1:
if calculate_hcf(x, y) == 1 and calculate_hcf(y, z) == 1 and calculate_hcf(x, z) == 1:
print("взаимно простые")
else:
print("не взаимно простые")
Через функцию