Lucas Number
Submissions: 1612   Accuracy:

36.99%

  Difficulty: Easy   Marks: 2

A Lucas Number is a number which is represented by the following recurrence
Ln = Ln-1 + Ln-2 for n>1
L0 = 2
L1 = 1

Now given a number n your task is to find the nth lucas number.

Note: Since the output could be very long take mod 1000000007

Input:
The first line of input contains an integer T denoting the number of test cases. Then T test cases follow. Each line contains an integer n.

Output:
For each test case, in a new line, print the nth lucas number.

Constraints:
1 <= T <= 100
1 <= n <= 100

Example:
Input:

2
9
3
Output:
76
4

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

Author: Shubham Joshi 1


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.