Question: A recursive formula can be implemented in Python and then used to provide the nth term in a series. Which of the following recursive programs

A recursive formula can be implemented in Python and then used to provide the nth term in a series.
Which of the following recursive programs implements the recursive formula below and prints out the value of its 5th term (31):
base: a(1)=-5
recursion: a(n)= a(n -1)+9
def recursive_2(num):
if num ==5:
return -5
return recursive_2(num -1)+9
print('rec_2',recursive_2(5))
def recursive_2(num):
if num ==1:
return -5
return recursive_2(num -1)+9
print('rec_2',recursive_2(5))
def recursive_2(num):
if num ==1:
return 9
return recursive_2(num -1)-5
print('rec_2',recursive_2(5))
def recursive_2(num):
if num ==1:
return -5
return recursive_2(num +1)+9
print('rec_2',recursive_2(5))

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 Databases Questions!