Pythagorean triples/Java/Brute force primitives: Difference between revisions

Content added Content deleted
m (With the GCD check we can be sure that we have found a primitive, so we can mark them (negligible speed change))
m (Forgot to update the output, remove runtime check)
Line 75: Line 75:
public static void main(String[] args){
public static void main(String[] args){
long primCount = 0;
long primCount = 0;
long start = System.currentTimeMillis();
BigInteger peri2 = LIMIT.divide(TWO),
BigInteger peri2 = LIMIT.divide(TWO),
Line 131: Line 130:
}</lang>
}</lang>
Output:
Output:
<pre>3, 4, 5
<pre>3, 4, 5 primitive
5, 12, 13
5, 12, 13 primitive
6, 8, 10
6, 8, 10
7, 24, 25
7, 24, 25 primitive
8, 15, 17
8, 15, 17 primitive
9, 12, 15
9, 12, 15
9, 40, 41
9, 40, 41 primitive
10, 24, 26
10, 24, 26
12, 16, 20
12, 16, 20
12, 35, 37
12, 35, 37 primitive
15, 20, 25
15, 20, 25
15, 36, 39
15, 36, 39
16, 30, 34
16, 30, 34
18, 24, 30
18, 24, 30
20, 21, 29
20, 21, 29 primitive
21, 28, 35
21, 28, 35
24, 32, 40
24, 32, 40