Function to check if all the pairs of array elements are coprime with each other
static bool allCoprime ( int [ ] A , int n ) { bool all_coprime = true ; HashSet < int > factors = new HashSet < int > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( A [ i ] == 1 ) continue ;