Question: Padovan sequence is something similar to Fibonacci sequence. It is given as the following sets of formulas, where P ( n ) is the n

Padovan sequence is something similar to Fibonacci sequence. It is given as the following sets of formulas, where P(n) is the n-th Padovan number:
P(0)= P(1)= P(2)=1
P(n)= P(n-2)+ P(n-3)
Write an iterative function in Python (i.e. use loop instead of recursion) padovan(n) to compute and return the n-th Padovan number.
For example, function call padovan(2) should return 1 and function call padovan(3) should return 2.

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!