T ^ tSaffahI am so sincere that I want to do a set of noip simulation questions.
Question 1
Good Diao name...
Given a team of $ N and Q $, find the length of the auto-multiplication cycle in the meaning of $ N $.
$0 $ is output when $ x = 0 $, right...
........................................ ......... It is too weak .................................... ................
No idea .....
Read the questions again
During multiplication in the meaning of model N, mengegg finds that there are always some numbers which will change to 1 after multiplication several times. For example, n = 7, then 5x5 mod 7 = 4, 4x5 mod 7 = 6, 6x5 mod 7 = 2, 2X5 mod 7 = 3, 3x5 mod 7 = 1. If you continue to multiply, it will be in a loop. Meng egg also found that the cycle length is usually PHI (N), that is, the number of positive integers smaller than N and intersect with N. For example, the length of the above loop is 6, because 5, 4, 6, 2, 3, and 1 have 6 numbers. If n = 6, 5x5 mod 6 = 1. The length of this loop is very short, only 2, and it happens to be PHI (6) = 2. However, in some cases, although the cycle length can be PHI (N), there are smaller lengths than PHI (n): for example, n = 7, 2 × 2 mod 7 = 4, 4 × 2 mod 7 = 1, and the cycle length is only 3. Of course, 6 can also be the length of a loop. Assuming that we know n, we call it the magic of number A. if and only when the cycle length of number A can be PHI (n), and there is no ratio PHI (N) A shorter cycle. For example, n = 7, 5 is magical, and 2 is not magical. Now I will give n and Q queries. Each time I ask for a, I will ask if A is magical.
The condition that the cycle length is PHI (n... since $ x ^ {Phi \ left (n \ right)} \ equiv 1 \ pmod {n} $, it looks like Euler's theorem... tell me loudly !!!
I know that there is a p app... it's really a book that hates less...
Let's wait for the official answer from saffah.
Ch round #55 streaming #6