You are viewing a single comment's thread. Return to all comments →
For a detailed explanation check out Project Euler 91
import math N = int(input()) t = sum(min(x*m//y, m*(N - y)//x) for x in range(1, N+1) for y in range(1, N) for m in [math.gcd(x, y)]) print(2*t + 3*N*N)
Seems like cookies are disabled on this browser, please enable them to open this website
Project Euler #91: Right triangles with integer coordinates
You are viewing a single comment's thread. Return to all comments →
For a detailed explanation check out Project Euler 91