Anonymous user
Pythagorean triples/Java/Brute force primitives: Difference between revisions
Pythagorean triples/Java/Brute force primitives (view source)
Revision as of 18:30, 14 December 2011
, 12 years agoThis is what I was really looking for when I made that last optimization
(Another slight speedup) |
(This is what I was really looking for when I made that last optimization) |
||
Line 85:
for(BigInteger b = a.add(ONE);
b.compareTo(peri2) < 0; b = b.add(TWO)){
//
if(amod3
//if a^2 + b^2 is not a perfect square then don't even test for c's
BigInteger aabb = aa.add(b.multiply(b));
Line 95 ⟶ 94:
(aabb.and(B127).intValue() != 16) &&
(aabb.and(B191).intValue() != 0)) continue;
BigInteger ab = a.add(b);
|