# SICP Solutions

### Chapter 5, Computing with Register Machines

#### Exercise 5.27

As in last exercise, let’s first see some results for various values of n:

Clearly the formulae is:

and

Thus we get the following table:

Maximum depth Number of pushes
Recursive factorial $\, \text{maximum-depth} = 5n+3 \,$ $\, \text{total-pushes} = 32n - 16 \,$
Iterative factorial $\, \text{maximum-depth} = 10 \,$ $\, \text{total-pushes} = 35n + 29 \,$