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

m
Incredibly slight optimization (took the runtime of a 10k perimeter limit from 90 seconds to 89 seconds on this computer)
m (Extra notes and comments, move a comparison so it is only calculated if needed.)
m (Incredibly slight optimization (took the runtime of a 10k perimeter limit from 90 seconds to 89 seconds on this computer))
Line 95:
}else if (compare == 0){
Triple prim = new Triple(a, b, c);
if(trips.add(prim)){ primCount++; //if it's new
addAllScales(prim) primCount++; //count it
addAllScales(prim); //add its scales
}
}
}
Anonymous user