exercise 30 -- rewriting 'sum' so it uses iterative recursion
exercise 1.31: product