Artifact Content
Not logged in

Artifact 395c6eb44878070252ff0bb48d24b9f642b08ad4



//-------------------------------------------------------------
// Enumerate coprime pythagoras triangles
//
// Verified by
//   - SRM 599 Div1 LV2
//-------------------------------------------------------------


for(int m=1;; ++m)
for(int n=1; n<m; ++n) if(((m^n)&1) && gcd(m,n)==1)
{
	int a = m*m-n*n, b = 2*m*n, c = m*m+n*n;
	if(a>b) swap(a,b);
}