We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
If a is odd then a^2 is also odd.
Now there exists a k, such that, a=2k+1
Therefore a^2=(2k+1)^2=4k^2+4k+1=2b+1, where b=2k^2+2k
Hence, a^2=2b+1=(b+1)^2-b^2.
i,e, a^2+b^2=c^2, where c=b+1
If a is even then there exists an m such that 2m=a. We know that, (m^2-1)^2+(2m)^2=(m^2+1)^2 , hence a=2m , b=m^2-1 and c=m^2+1.
Cookie support is required to access HackerRank
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 →