Curious Recursion p1
Curious Recursion p1
� � // Recursive function H
� � }
� � }
� �
}
/*
� � What common functions are computed by H(n, a, b):
� � 1. H(0, a, b):
� � � �- This computes b + 1.
� � � �- It behaves as the "successor function," simply returning b + 1 regardless
of a.
� � 2. H(1, a, b):
� � � �- This computes a + b.
� � � �- It behaves as addition of a and b. For example, H(1, a, b) = a + b.
� � 3. H(2, a, b):
� � � �- This computes a * b.
� � � �- It behaves as multiplication of a and b. For example, H(2, a, b) = a * b.
� � 4. H(3, a, b):
� � � �- This computes a^b (exponentiation).
� � � �- It behaves as exponentiation, where a is raised to the power of b. For
example, H(3, a, b) = a^b (a to the power of b).
*/