Symbol(clack:cancel)

This commit is contained in:
2025-12-26 17:35:14 +08:00
parent 266544ac47
commit 25469e1022
54 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
"""
a^2 + b^2 = c^2
a + b + c = 1000
FIND a*b*c
"""
def euler_9():
for a in range(1, 1000):
for b in range(a, 1000):
c = 1000 - a - b
if a**2 + b**2 == c**2:
print(f"Found a={a}, b={b}, c={c}")
return a * b * c
if __name__ == "__main__":
print(euler_9())

View File

@@ -0,0 +1,7 @@
这个问题从数学上,需要换元替代计算。
a = k(m^2 - n^2)
b = 2kmn
c = k(m^2 + n^2)
基于这个换元进新推导。或者就是直接基于原始命题进行计算,可以参见 [这个解答](https://math.stackexchange.com/a/3378895) 。