[CF1316C] Primitive Primes - Number Theory

Given two sequences \ (A, B \) , to ensure that all the numbers in each sequence of GCD \ (1 \) , provided \ (A * B = C \) , given a prime number \ (P \) , seek \ (T \) such that \ (C_T \) can not be \ (P \) divisible

\(n,m \leq 10^6, x \leq 10^9\)

Solution

To \ (C_i \ BMOD P \ NEQ 0 \) , then \ (a_0b_i, a_1b_ {i- 1}, \ dots, a_ib_0 \) has at least a satisfying \ (a_xb_y \ NEQ 0 \ BMOD P \) , which requirements \ (a_x, b_y \ neq 0 \ BMOD the p-\) , so we only need to press the standard small to large to find the first \ (a_i \ neq 0, b_j \ neq 0 \ BMOD the p-\) , so \ (i + j \) is the answer

Adequacy consideration, can not be set by the first (P \) \ divisible is \ (a_i, b_j \) , then for \ (C_ {I + J} \) , it must contain other items \ (P \) factor

Guess you like

Origin www.cnblogs.com/mollnn/p/12460175.html