The number x is called a square root of a modulo n (root( a, n)) if x* x = a (mod n). Write the program to find the square root of number a by given modulo n.
Input
One number K in the first line is an amount of tests ( K ≤ 100000). Each next line represents separate test, which contains inte
Description
Fib数列为1,1,2,3,5,8...
求在Mod10^9+9的意义下,数字N在Fib数列中出现在哪个位置
无解输出-1
Input
一行,一个数字N,N < = 10^9+9
Output
如题
Sample Input
3
Sample Output
4
109+910^9+9明示55有二次剩余。
考虑FibFib的通项公式:
fn=1√5((1+√52)n−(1−√52)n) f_n=\frac{1}{\sqrt 5}\left (\left (\frac{1+\sqrt 5}{2}\