Python recursion problem | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Python recursion problem

Can anyone tell me the logic behind this series??? 0 1 1 1 2 2 3 4 5 7 9 12 16 21 28 37 49 65..... I have to construct a recursive function for this

2nd Aug 2021, 6:25 AM
Anjali Singh
Anjali Singh - avatar
2 Answers
+ 2
It is possibly starting with 5 initial numbers , 0 1 1 1 2 and then builds the rest of series by adding previous number 4 index away from current number to present number. For example adding 0 to 2 will yield 2 and then adding 1 to 2 will give us 3
2nd Aug 2021, 7:11 AM
Abhay
Abhay - avatar
0
Yes I did it and found the logic... implemented using for loop bt now thinking how can I do it using recursion.
2nd Aug 2021, 7:39 AM
Anjali Singh
Anjali Singh - avatar