由余弦定理不难看出只有60度、90度和120度角符合要求。结合第75题、第143题和第195题的方法即可得结果$416577688$。
from fractions import gcd
bound=100000000
r=33333333
for m in range(2,10000):
for n in range(1,m):
for a,b,c in ((m*m-n*n,2*m*n,m*m+n*n),(m*m-n*n,2*m*n+n*n,m*m+n*n+m*n),(m*m-n*n,2*m*n+m*m,m*m+n*n+m*n),(2*m*n+n*n,2*m*n+m*m,m*m+n*n+m*n)):
if gcd(gcd(a,b),c)==1:r+=bound/(a+b+c)
if m%100==0:print m/100,"percent completed"
print r
|