import math
def lcm(a, b):
return a * b // math.gcd(a, b)
def lcm_range(n):
lcm_value = 1
for i in range(2, n+1):
lcm_value = lcm(lcm_value, i)
return lcm_value
n = 81 # 输入给定的数值n
result = lcm_range(n)
print(f"1到{n}的所有数字的最小公倍数是:{result}")
上述gpt给的答案是错的,验证数字81
作者:ukyo--BlackJesus