Anonymous user
Pythagorean triples: Difference between revisions
Coprime special case clarification
(+Arbitrary precision Java) |
(Coprime special case clarification) |
||
Line 1:
{{draft task}}
A [[wp:Pythagorean_triple|Pythagorean triple]] is defined as three positive integers <math>(a, b, c)</math> where <math>a\leq b\leq c</math>, and <math>a^2+b^2=c^2.</math> They are called primitive triples if <math>a, b, c</math> are coprime, that is, if their pairwise greatest common divisors <math>{\rm gcd}(a, b) = {\rm gcd}(a, c) = {\rm gcd}(b, c) = 1</math>. Because of their relationship through the Pythagorean theorem, a, b, and c are coprime if a and b are coprime (<math>{\rm gcd}(a, b) = 1</math>). Each triple
'''Task'''
Line 43:
<lang java>import java.math.BigInteger;
public class PythTrip
public static void main(String[] args){
long tripCount = 0, primCount = 0;
|