-
-
Save chunkybanana/d4a5fc0fc756d1d24cf8429a175ddb7c to your computer and use it in GitHub Desktop.
This file contains 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
All pythagorean triples can be generated from two integers m and n with the following: | |
a = m^2 - n^2 | |
b = 2mn | |
c = m^2 + n^2 | |
If either m or n is divisible by 3, then b is divisible by three. Else, there are three possibilities for m and n (modulo 3): | |
(2, 1) => 2^2 - 1^2 = 3, divisible by 3 | |
(2, 2) => 2^2 - 2^2 = 0, divisible by 3 | |
(1, 1) => 1^2 - 1^2 = 0, divisible by 3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment