You are viewing a single comment's thread. Return to all comments →
def pythagoreanTriple(a): if a%2 ==1 : n= (a-1)//2 m=n+1 else : if a % 4 == 0: m = a//4 + 1 n = a//4 -1 else : n=1 m=a//2 return [m**2-n**2,2*m*n,m**2+n**2]
Seems like cookies are disabled on this browser, please enable them to open this website
Pythagorean Triple
You are viewing a single comment's thread. Return to all comments →
def pythagoreanTriple(a): if a%2 ==1 : n= (a-1)//2 m=n+1 else : if a % 4 == 0: m = a//4 + 1 n = a//4 -1 else : n=1 m=a//2 return [m**2-n**2,2*m*n,m**2+n**2]