exercise 1.16 iterative fast-expt