Problem statement
Fibonacci numbers are defined by the function f where f(0) = 0; f(1) = 1; and f(n) = f(n - 1) + f(n - 2).The sequence goes 0, 1, 1, 2, 3, 5, 8, . . .
Lucas numbers are very similar and are defined by the function f where f(0) = 2; f(1) = 1; and f(n) = f(n - 1) + f(n - 2).The sequence goes 2, 1, 3, 4, 7, 11, 18, 29, . . .
There are many, many relationships between these two sequences.Write a program to calculate and print the nth Lucas number modulo m.Specifically, you need to consider some very, very large values for n and relatively small values for m.
Input
The input file will contain many test cases. Each test case consists of one line containing two integers n and m. Both are positive and small enough to fit inside a 64-bit unsigned type. Handle every line.
Output
For each set of test values n and , print the nth Lucas number modulo m. as shown below. At the end, your program must print your family name in Pinyin, your personal name in Pinyin, your full name in Simplified Chinese, and your NUPT ID number EXACTLY in that order. Print the required information on one line by itself. Separate the elements by a single semicolon (no spaces) exactly as shown in the sample output.(This shows that all input has been processed and no errors have occurred.)
Sample Input
1 2
2 1
2 4
4 2
3 8
8 3
4 16
16 4
Sample Output
1
0
3
1
4
2
7
3
Wang;Haojie;王皓杰;H10000708
NOTE CAREFULLY: Pay close attention to spaces and punctuation. Your program must produce exactly the required output (nothing extra) and DETAILS COUNT. The sample input and output are often suggestive. Your program will likely be tested with DIFFERENT data.)
Fibonacci numbers are defined by the function f where f(0) = 0; f(1) = 1; and f(n) = f(n - 1) + f(n - 2).The sequence goes 0, 1, 1, 2, 3, 5, 8, . . .
Lucas numbers are very similar and are defined by the function f where f(0) = 2; f(1) = 1; and f(n) = f(n - 1) + f(n - 2).The sequence goes 2, 1, 3, 4, 7, 11, 18, 29, . . .
There are many, many relationships between these two sequences.Write a program to calculate and print the nth Lucas number modulo m.Specifically, you need to consider some very, very large values for n and relatively small values for m.
Input
The input file will contain many test cases. Each test case consists of one line containing two integers n and m. Both are positive and small enough to fit inside a 64-bit unsigned type. Handle every line.
Output
For each set of test values n and , print the nth Lucas number modulo m. as shown below. At the end, your program must print your family name in Pinyin, your personal name in Pinyin, your full name in Simplified Chinese, and your NUPT ID number EXACTLY in that order. Print the required information on one line by itself. Separate the elements by a single semicolon (no spaces) exactly as shown in the sample output.(This shows that all input has been processed and no errors have occurred.)
Sample Input
1 2
2 1
2 4
4 2
3 8
8 3
4 16
16 4
Sample Output
1
0
3
1
4
2
7
3
Wang;Haojie;王皓杰;H10000708
NOTE CAREFULLY: Pay close attention to spaces and punctuation. Your program must produce exactly the required output (nothing extra) and DETAILS COUNT. The sample input and output are often suggestive. Your program will likely be tested with DIFFERENT data.)