Pythagorean triples: Difference between revisions

Content added Content deleted
(Cleaned D code)
(Removed static from D code)
Line 179: Line 179:
void triples(in xint lim,
void triples(in xint lim,
in xint a=3, in xint b=4, in xint c=5) nothrow {
in xint a=3, in xint b=4, in xint c=5) nothrow {
static enum xint[9][3] U = [[ 1, -2, 2, 2, -1, 2, 2, -2, 3],
enum 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],
[-1, 2, 2, -2, 1, 2, -2, 2, 3]];
[-1, 2, 2, -2, 1, 2, -2, 2, 3]];
const xint p = a + b + c;
const xint p = a + b + c;
if (p > lim)
if (p > lim)