Last three digits of the integer part
Time limit2sMemory limit512 MB
For each n up to 2e9, report the last three digits of the integer part of (3+sqrt(5))^n, zero padded to three digits.
- Level
Medium7 of 10
- Topics
- Math, Number theory, Matrix, Divide and conquer
- Solved
- No attempts yet
Problem
Find the last three digits of the integer part of .
For example, with , , so the answer is 935.
If the integer part has fewer than three digits, pad it with leading zeros so the answer always has three digits. For example, with , , so the answer is 027.
Input
The first line contains the number of test cases ().
Each of the next lines contains one natural number ().
Output
For each test case, print the answer on one line in the form Case #c: x. Here is the test case number, counted from 1, and is the answer for that test case. Always write with three digits.