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