iscongruent(n)= { i=0;j=0;\ if(issquare(n),print(n," is not a congruent number"),\ m=core(n);\ if(m%8==5||m%8==6||m%8==7,print(n," is a congruent number"),\ if(m%2,\ for(x=-round(sqrt(m/2)),round(sqrt(m/2)),\ for(y=-round(sqrt(m)),round(sqrt(m)),\ for(z=-round(sqrt(m/8)),round(sqrt(m/8)),\ if(2*x^2+y^2+8*z^2==m,i++,))));\ for(x=-round(sqrt(m/2)),round(sqrt(m/2)),\ for(y=-round(sqrt(m)),round(sqrt(m)),\ for(z=-round(sqrt(m/32)),round(sqrt(m/32)),\ if(2*x^2+y^2+32*z^2==m,j++,))));\ if(i==2*j,print(n," is a congruent number"),print(n," is not a congruent number")),\ k=m/2;\ for(x=-round(sqrt(k/4)),round(sqrt(k/4)),\ for(y=-round(sqrt(k)),round(sqrt(k)),\ for(z=-round(sqrt(k/8)),round(sqrt(k/8)),\ if(4*x^2+y^2+8*z^2==k,i++,))));\ for(x=-round(sqrt(k/4)),round(sqrt(k/4)),\ for(y=-round(sqrt(k)),round(sqrt(k)),\ for(z=-round(sqrt(k/32)),round(sqrt(k/32)),\ if(4*x^2+y^2+32*z^2==k,j++,))));\ if(i==2*j,print(n," is a congruent number"),print(n," is not a congruent number"))))) } addhelp(iscongruent , "iscongruent(n) : determines if n is a congruent number (assuming BSD).") printp("iscongruent(n) : determines if n is a congruent number (assuming BSD).")