Let me first explain my problem:
I am trying to write a program that can generate operations that compare a set of data rather than pulling from a list of possible relations. I have it to the point where it can generate exponentiation but I think it might be easier to generate the square root algorithm by reversing the generated exponentiation. To do this I need to understand a simple way to find square roots from perfect squares (they will be perfect, I am using integer math right now).
The simpler the better but I am not looking for something that searches every possibility. I need an algorithm.
Thanks
Newton's method for computing $\sqrt n$ is fast and simple to implement. For example, here is C code to do it: