Pythagorean triples: Difference between revisions

Faster D version
(Faster D code)
(Faster D version)
Line 179:
void triples(in xint in0, in xint in1, in xint in2,
in xint maxPeri) nothrow {
static constenum xint[9][3] U = [[ 1, -2, 2, 2, -1, 2, 2, -2, 3],
[ 1, 2, 2, 2, 1, 2, 2, 2, 3],
[-1, 2, 2, -2, 1, 2, -2, 2, 3]];
const xint p = in0 + in1 + in2;
if (p > maxPeri)
Line 216:
Up to 100000000: 113236940 triples, 7023027 primitives.
Up to 1000000000: 1294080089 triples, 70230484 primitives.</pre>
Runtime up to 1_000_000_000: about 95.48 seconds.
 
=={{header|Icon}} and {{header|Unicon}}==
Anonymous user