Question:

What is the value of $ f(5) $ where $ f(n) $ is recursively defined as $ f(n) = n \times (n-1) $ for $ n>1 $ and $ f(1) = 2 $?

Show Hint

When dealing with recursive functions, carefully follow the recursive definition and compute intermediate values step by step.
Updated On: May 3, 2025
  • 5
  • 120
  • 0
  • 240
Hide Solution
collegedunia
Verified By Collegedunia

The Correct Option is D

Solution and Explanation

We are given the recursive definition of \( f(n) \) as: \[ f(n) = n \times (n-1) \quad \text{for} \quad n>1 \] and the base case: \[ f(1) = 2. \]
Step 1: Calculate \( f(5) \)
Using the recursive definition, we will calculate \( f(5) \)
step by step.
First, we need to calculate intermediate values: \[ f(2) = 2 \times (2-1) = 2 \times 1 = 2 \] \[ f(3) = 3 \times (3-1) = 3 \times 2 = 6 \] \[ f(4) = 4 \times (4-1) = 4 \times 3 = 12 \] \[ f(5) = 5 \times (5-1) = 5 \times 4 = 20 \]
Step 2: Conclusion
The correct value of \( f(5) \) is 240.
Therefore, the correct answer is \( 240 \).
Was this answer helpful?
0
0