Hello Codeforces, I have encountered a difficult GCD problem which I am unable to solve any help would be appreciated.
Problem : you are given two arrays A and B . for every i from [1 , N] , find the number of pairs (i,j) such that gcd(A[i],B[j]) !=1.
1 <= N <= 1e5
1 <= A[i], B[j] <= 1e6
Note: one based indexing is being followed here .
I am unable to come up with any approach to solve this problem,any help would be appreciated !