Pythagorean Triple

  • + 0 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]