Hackerrank Fibonacci Modified Recursive Solution
This is the solution for the Fibonacci Modified Problem found under the dynamic programming section at hackerrank. You need to find the (n+k)th term of the generated series, where nth and (n+1)th term will be supplied as input. The nth and (n+1)th terms, the (n+2)th can be computed by the following relation : Tn+2 = (Tn+1)2 + Tn So, if the first two terms of the series are 0 and 1 and k is 5 then the third term = 1 2 + 0 = 1 fourth term = 1 2 + 1 = 2 fifth term = 2 2 + 1 = 5 Screenshots[Demo] The Code def fibo(a,b,n): if(n==0): return b; else: return fibo(b,b**2+a,n-1) x=raw_input() x=x.split() print fibo(int(x[0]),int(x[1]),int(x[2])-2) Found Bugs, feel free to report them !