Hi, David & All!

You method (IMHO) based upon the following:

Let A be the number to factor. Using common solution to Pythagoras, we can

write:

A=U^2-V^2

B=2*U*V

C=U^2+V^2

so that A^2+B^2=C^2.

Then B+C=(U+V)^2, B-C=(U-V)^2 as in your examples. But it is *not* common

solution!

For instance, the least solution to A^2+B^2=C^2 with A=123 is

123^2+164^2=205^2

Both your C-program and my pascal one find this solution. But,alas

205-164=41 is *not* square, neither is

205+164=369=3^2*41.

All this nightmare is due to fact that common solution to Pythagoras is

A=K*(U^2-V^2)

B=2*K*U*V

C=K*(U^2+V^2)

and, for instance, B+C=K*(U+V)^2. Only GCD can help, or another solution to

Pythagoras.

Aleksey