Symbol(clack:cancel)
This commit is contained in:
18
solutions/0000_0029/0009/eular_9.py
Normal file
18
solutions/0000_0029/0009/eular_9.py
Normal 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())
|
||||
7
solutions/0000_0029/0009/readme.md
Normal file
7
solutions/0000_0029/0009/readme.md
Normal 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) 。
|
||||
Reference in New Issue
Block a user