佩尔数列是一种经典的递推数列,其定义如下:
第 1 项:P(1)=1
第 2 项:P(2)=2
当 n≥3 时,P(n)=2×P(n−1)+P(n−2)
给定一个正整数 n,请你计算佩尔数列的第 n 项。
输入一个正整数 n(1≤n≤30)
输出佩尔数列的第 n 项。
3
5
29