Indefinite recursion

Course links

Exercise 1

By hand calculation, find the Collatz sequences for 1, 2, 3, and 4. Use DrScheme to find the Collatz sequences for 25, 26, 27, and 28.

Exercise 2

Rewrite the longest-list-in-list procedure, from the lab on local bindings, so that it yields the same result but is tail-recursive.

Exercise 3

Develop a tail-recursive version of the factorial procedure presented in the reading on recursion with integers.

Exercise 4

Develop a tail-recursive version of the iota procedure described in exercise 4 of the lab on recursion with integers.

Exercise 5

Is the prime-factors-kernel procedure presented in the reading on indefinite recursion tail-recursive? If so, explain why. If not, explain why not and develop and test a tail-recursive version of it.