Write a Python function to return Padovan's Sequence


Topic: Write a Python function to return Padovan's Sequence

Solution

def padovan_seq(n):
    if n >= 0:
        if n in {0,1,2}:
            return 1
        else:
            return padovan_seq(n-3) + padovan_seq(n-2)
    



List all Python Programs