From this little aside, it is apparent that the number of
iterations it takes to square a is
.
To be more precise, the exact number of iterations is
.
Here, the ``floor'' function,
is the
largest integer not exceeding x (rounding down). This is in
contrast to the ``ceiling'' function
, which rounds
up.
We will prove this bound in a moment. But first, let's look at an alternate way of writing the algorithm.