Orig Description
Score : 200 points
Problem StatementIt is November 18 now in Japan. By the way, 11 and 18 are adjacent Lucas numbers.
You are given an integer N. Find the N-th Lucas number.
Here, the i-th Lucas number L_i is defined as follows:
L_0=2
L_1=1
L_i=L_{i-1}+L_{i-2} (i≥2)
Constraints
1≤N≤86
It is guaranteed that the answer is less than 10^{18}.
N is an integer.
InputInput is given from Standard Input in the following format:
N
OutputPrint the N-th Lucas number.
Sample Input 15
Sample Output 111
L_0=2
L_1=1
L_2=L_0+L_1=3
L_3=L_1+L_2=4
L_4=L_2+L_3=7
L_5=L_3+L_4=11
Thus, the 5-th Lucas number is 11.
Sample Input 286
Sample Output 2939587134549734843
Test Case Generator
Sure, here is a test case generator for the given problem statement:
```python
import random
def lucas_number_generator(n):
"""Generate the nth Lucas number."""
if n == 0:
return 2
elif n == 1:
return 1
else:
a, b = 2, 1
for _ in range(2, n + 1):
a, b = b, a + b
return b
def tcgen():
# Generate a random integer N within the specified constraints
N = random.randint(1, 86)
# Generate the expected Lucas number for verification
lucas_num = lucas_number_generator(N)
return N, lucas_num
# Example usage
if __name__ == "__main__":
for _ in range(5): # Generate 5 test cases
N, expected_lucas_number = tcgen()
print(f"Input: {N}")
print(f"Expected Output: {expected_lucas_number}\n")
```
### Explanation:
1. **Lucas Number Generator Function (`lucas_number_generator`)**:
- This function computes the `N`-th Lucas number using an iterative approach to avoid the overhead of recursion and potential stack overflow issues for larger values of `N`.
2. **Test Case Generator Function (`tcgen`)**:
- It generates a random integer `N` within the range `[1, 86]`, as specified in the problem constraints.
- It then computes the `N`-th Lucas number using the `lucas_number_generator` function for verification purposes.
3. **Example Usage**:
- The `for` loop generates five random test cases, printing both the input `N` and the expected Lucas number output.
This generator ensures that the test cases are valid and within the problem's constraints, and it can be used to verify the correctness of solutions to the problem.