Check for each divisor i . e . arr [ i ] % b = k or not , if yes then print that pair .
for ( let j = 0 ; j < v . length ; j ++ ) { if ( arr [ i ] % v [ j ] == k && arr [ i ] != v [ j ] && occ . get ( v [ j ] ) ) { document . write ( " " + arr [ i ] + " " + v [ j ] + " " ) ; isPairFound = true ; } }