Divide top by D [ i ] if it is possible and push the result in q
if ( d [ i ] != 0 && top % d [ i ] == 0 && ! visited [ top / d [ i ] ] ) { q . push ( top / d [ i ] ) ; visited [ top / d [ i ] ] = true ; }