Homework: Recursion I


For each of the following problems, you need to find a recursive solution. For problems involving NaturalNumber, use only the kernel methods. Do not use "tricks" like converting a NaturalNumber into a String and then solving the problem on the String.

  1. Implement the static method declared as follows:
  2. Implement the static method declared as follows:
  3. In addition to the kernel methods, for this question (only!) you are allowed to use the NaturalNumber method add. Implement the static method declared as follows:
  4. Implement the static method declared as follows:
  5. Implement the static method declared as follows: