/* danml.tc - tct */ /* main takes 2 arguments, h and k. h is the starting hypotenuse and */ /* h+k is the ending hypotenuse. The two legs of the right triangles */ /* that have these hypotenuses are displayed. */ /* motivated by dan minton discussion */ gcd int a,b [ if (b==0) return a else return gcd b,a%b ] foo int i,j,h [ int b,c,d b=gcd(i,j);c=gcd(j,h);d=gcd(i,h) if ((b!=1)*(b==c)*(c==d)) [ pn b;ps " x";pn i/b;pn j/b;pn h/b ps " (";pn i;pn j;pn h;ps " )";pl "";return 1 ] return 0 ] danm int h [ int i,j,c,w,wx;c=h*h for (i=1;(w=i*i)0) break if !wx [ if !foo(i,j,h) [ pn i;pn j;pn h;pl "" ]]]]] main int h,k [ pl "";ps "danml.tc - 6/20/2012";pl "";pl "" int i for (i=h;i<=h+k;++i) danm i putchar 7 /* beep! */ exit ]