Check-in [64a27e41ea]
Not logged in
Overview
SHA1 Hash:64a27e41eaafdc567a7f3830fee54cfa4c82ab63
Date: 2013-12-05 00:28:44
User: kinaba
Comment:Pythagoras generator
Timelines: family | ancestors | descendants | both | trunk
Downloads: Tarball | ZIP archive
Other Links: files | file ages | manifest
Tags And Properties
Changes

Added lib/geo/pythagoras.cpp version [6328445c69b877f6]

1 +// Enumerate coprime pythagoras triangles 2 + 3 +for(int m=1;; ++m) 4 +for(int n=1; n<m; ++n) if(((m^n)&1) && gcd(m,n)==1) 5 +{ 6 + int a = m*m-n*n, b = 2*m*n, c = m*m+n*n; 7 + if(a>b) swap(a,b); 8 +}