Pell Number
Submissions: 1805   Accuracy:

9.01%

  Difficulty: Easy   Marks: 2

Pell numbers are numbers that are similar to the Fibonacci numbers and are generated by below formula
Pn = 2*Pn-1 + Pn-2
with seeds P0 = 0 and P1 = 1
Your task is to print Nth pell number.

Input:
First line consists of T test cases. Only line of every test case consists of N.

Output:
Single line output, print the Nth pell number.

Constraints:
1<=T<=100
1<=N<=100

Example:
Input:

1
4
Output:
12

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Saksham Raj Seth
Author: saksham seth


If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.

to report an issue on this page.