Function to return the value of
for x,
using the
case. So we have verified the loop invariant by induction.
so gcd(1018215,2695)=55, by the Euclidean algorithm.
Note in particular that i is stepping down in this case by 1, rather than up as it has in the other examples.
using the
case. So we have verified the loop invariant by induction.
At termination:
,
so
.