Step 2, correctness is relatively easy. It follows from the
definition. We know the
, so we start checking
all the numbers from a down to 1 to see if any divide both numbers.
Whichever one does is the greatest (because we are working our way
down) common divisor.
Why does it terminate? Because 1 divides everything.
Step 3 (efficiency analysis) is much more subtle. Unlike multiplication, it doesn't grow steadily with a. The number of recursive calls could be anywhere between 1 and a!