Question: Consider the following recursive function: This recursive function generates the following sequence: 7 , 2 6 , 8 3 , 1 5 4 , .

Consider the following recursive function:
This recursive function generates the following sequence:
7,26,83,154,....
Create a recursive program that asks the user to enter a positive integer N and then displays the value (the value of the Nth term in the sequence).
For example, if the user enters 3 the output is 83(the 3rd term in the sequence). If the user enters 5, the output is 767(the 5th term in the sequence).
Hint: To build the recursive module, start at the beginning of the sequence and build up to the term you need. That is, use the value of f (2) to find f 9(3), then use the value of f (3) to find f (4), and so on.
Note: For full credit:
You must use recursion (i.e. a recursive module) to create this program. If you use a loop instead of recursion for this program you will receive 0 for this problem.
You must use parameters to pass information to the module.
The inputs and outputs must include appropriate sentences.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!