Fibonacci Lucky Numbers
Time limit2sMemory limit1024 MB
Given n, output the last 10 digits of the Fibonacci number whose index is 7 raised to 7 raised to 7^n, for up to 20 test cases.
- Level
Medium7 of 10
- Topics
- Number theory, Math, Matrix
- Solved
- No attempts yet
Problem
Welcome to the Lucky 777 Slot Game! This game is known for its complex math problems, and only the smartest players win the jackpot.
The slot machine runs on a mysterious sequence, the Fibonacci sequence. It is not the ordinary version, though. The twist is based on the number , the symbol of luck in slot games.
When you pull the lever on the Lucky 777 Slot Machine, it generates a huge number from an integer and a power of sevens: . This number is too large for even the most powerful computers to handle directly.
To claim the jackpot, you must compute the last digits of , the -th Fibonacci number.
Input
The first line contains an integer , the number of test cases. Each of the following lines is one test case and contains exactly one positive integer .
Output
For each test case, output one line with the last digits of .
Constraints
Hint
The Fibonacci sequence is defined as:
- for