Anonymous user
Pythagorean triples/Java/Brute force primitives: Difference between revisions
Pythagorean triples/Java/Brute force primitives (view source)
Revision as of 18:39, 20 December 2011
, 12 years agoForgot to update the output, remove runtime check
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:
public static void main(String[] args){
long primCount = 0;
BigInteger peri2 = LIMIT.divide(TWO),
Line 131 ⟶ 130:
}</lang>
Output:
<pre>3, 4, 5 primitive
5, 12, 13 primitive
6, 8, 10
7, 24, 25 primitive
8, 15, 17 primitive
9, 12, 15
9, 40, 41 primitive
10, 24, 26
12, 16, 20
12, 35, 37 primitive
15, 20, 25
15, 36, 39
16, 30, 34
18, 24, 30
20, 21, 29 primitive
21, 28, 35
24, 32, 40
|