Check if product is co - prime to product of either the left or right subarrays
if ( gcd ( product , right_prod [ j + 1 ] ) == 1 || gcd ( product , total_prod / right_prod [ i ] ) == 1 ) { flag = 1 ; document . write ( " " + ( i - 1 ) + " " + ( j + 1 ) + " " ) ; break ; } } if ( flag == 1 ) break ; }