Skip to content

Latest commit

 

History

History

padovan-numbers

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

The Padovan sequence is the sequence of integers defined by the initial values

P(0) = P(1) = P(2) = 1

and the recurrence relation

P(n) = P(n-2) + P(n-3)

The first few values of P(n) are:

1, 1, 1, 2, 2, 3, 4, 5, 7, 9, 12, 16, 21, 28, 37, 49, 65, 86, 114, 151, 200, 265, ...

Task

Your task is to write a method that returns nth Padovan number