Last active
June 26, 2022 19:24
-
-
Save smrfeld/59054643ad9179c2eeed08bccf42ec59 to your computer and use it in GitHub Desktop.
Simplified Pythagorean triple
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// b = (N^2 - 2Na) / (2N - 2a) | |
int num = n * n - 2 * n * a; | |
int denom = 2 * n - 2 * a; | |
if (num % denom != 0) | |
{ | |
continue; | |
} | |
int b = num / denom; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment