Step-by-step explanation:
In computer programming, a recursive function is one that calls itself and breaks when a certain condition is met, otherwise it keeps on running.
IN the given scenario, the recursive formula would be;
an = 3an - 1
Here n is nth term, an is the An value of function for nth term and An-1 is for one previous value.
global
int nth_val
int curr_val
int output = 2
def recursive(nth_val):
{
While ( curr_val < nth_val)
Print (Output)
Output = Output x 3;
curr_val++;
recursive(nth_val):
break
}
Int main void
{
Int number;
number = input("Please input the nth number of series: ")
nth_val = number
recursive(nth_value):
}