Help needed in this number theory problem

Правка en1, от chirag2505, 2022-06-10 14:27:23

Given an array of integers A of length N. For each index i, find number of indices j(j!=i) such that gcd(A[i],A[j])>1.

Constraints:
N<=1e5
1<=A[i]<=N

Example:

  1. A = [4,3,2,4] output = [2,0,2,2]

  2. A = [2,3,6,4,6,5] output = [3,2,4,3,4,0]

Теги number theory, gcd

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский chirag2505 2022-06-10 14:27:23 316 Initial revision (published)