The algorithm you've given is probably close to optimal for computing the square of

*all* integers 1 <= x <= max.

However, if you only want the square of only one number then straightforward multiplication is

*much* quicker. For the range 1 <= x <= 60000, there is no quicker way to square a number than just "y = x * x;"

For larger numbers whose squares don't fit in a word, there are more efficient algorithms. A description of many of them is given on

Carey Bloodworth's page